def _urlencode(items):
 try:
  return urllib.urlencode(items)
 except UnicodeEncodeError:
  return urllib.urlencode([(k, smart_str(v)) for (k, v) in items])

def _urlencode ( items ) : try : return urllib . urlencode ( items ) except UnicodeEncodeError : return urllib . urlencode ( [ ( k , smart_str ( v ) ) for ( k , v ) in items ] )
a unicode-safe urlencoder .