def quote(string, safe=u'/'):
 if (sys.version_info.major < 3):
  if isinstance(string, unicode):
   string = string.encode(u'utf8')
  string = urllib.quote(string, safe.encode(u'utf8'))
 else:
  string = urllib.parse.quote(str(string), safe)
 return string

def quote ( string , safe = u'/' ) : if ( sys . version_info . major < 3 ) : if isinstance ( string , unicode ) : string = string . encode ( u'utf8' ) string = urllib . quote ( string , safe . encode ( u'utf8' ) ) else : string = urllib . parse . quote ( str ( string ) , safe ) return string
returns quoted po term string .