def normalize_params(params)
      flatten_params(params).sort.map do |pair|
        pair.map { |item| percent_encode(item) } * '='
      end * '&'
    end
def normalize_params(params)
      flatten_params(params).sort.map do |pair|
        pair.map { |item| percent_encode(item) } * '='
      end * '&'
    end
Generate a percent-encoded query string from an object. The object may
 have nested arrays and objects as values. Ordinary top-level key-value
 pairs will be of the form "name=Bob", arrays will result in
 "cars[]=BMW&cars[]=Fiat", and nested objects will look like
 "user[name]=Bob&user[age]=50". All keys and values will be
 percent-encoded according to RFC5849 §3.6 and parameters will be
 normalised according to RFC5849 §3.4.1.3.2.