def filter(params, filter)
      if filter.empty? || !params.is_a?(Hash)
        params
      else
        filtered_params = {}
        params.each do |k, p|
          s = k.to_s
          if filter.include?(s)
            filtered_params[k] = FILTERED_PARAM_VALUE
          else
            filtered_params[k] = CONTENT_FILTERED_PARAMS.include?(s) ? filter(p, filter) : p
          end
        end
        filtered_params
      end
    end
def filter(params, filter)
      if filter.empty? || !params.is_a?(Hash)
        params
      else
        filtered_params = {}
        params.each do |k, p|
          s = k.to_s
          if filter.include?(s)
            filtered_params[k] = FILTERED_PARAM_VALUE
          else
            filtered_params[k] = CONTENT_FILTERED_PARAMS.include?(s) ? filter(p, filter) : p
          end
        end
        filtered_params
      end
    end
Apply parameter hiding filter

 @param [Hash, Object] params to be filtered with strings or symbols as keys
 @param [Array] filter names of params as strings (not symbols) whose value is to be hidden;
   also filter the contents of any CONTENT_FILTERED_PARAMS

 @return [Hash] filtered parameters