code: def _urlencode(items):
      
      try:
          return urllib.urlencode(items)
      except UnicodeEncodeError:
          return urllib.urlencode([(k, smart_str(v)) for k, v in items])
docs: A Unicode-safe URLencoder.