code: def dict2query(dictionary):
      
      query = []
      encoders = {dict: _dictionary_encoder}
      for k, v in dictionary.iteritems():
          if v.__class__ in encoders:
              nested_query = encoders[v.__class__](k, v)
              query += nested_query
          else:
              key = to_utf8(k)
              value = to_utf8(v)
              query.append('{}={}'.format(key, value))
  
      return '&'.join(query)
docs: We want post vars of form:
      {'foo': 'bar', 'nested': {'a': 'b', 'c': 'd'}}
      to become:
      foo=bar&nested[a]=b&nested[c]=d