code: def unicode_urlencode(query, doseq=True):
      
      pairs = []
      for key, value in query.items():
          if isinstance(value, list):
              value = list(map(to_utf8, value))
          else:
              value = to_utf8(value)
          pairs.append((to_utf8(key), value))
      encoded_query = dict(pairs)
      xx = urlencode(encoded_query, doseq)
      return xx
docs: Custom wrapper around urlencode to support unicode
  
      Python urlencode doesn't handle unicode well so we need to convert to
      bytestrings before using it:
      http://stackoverflow.com/questions/6480723/urllib-urlencode-doesnt-like-unicode-values-how-about-this-workaround