def quote_plus(string, safe='', encoding=None, errors=None):
 if ((isinstance(string, str) and (' ' not in string)) or (isinstance(string, bytes) and (' ' not in string))):
  return quote(string, safe, encoding, errors)
 if isinstance(safe, str):
  space = ' '
 else:
  space = ' '
 string = quote(string, (safe + space), encoding, errors)
 return string.replace(' ', '+')

def quote_plus ( string , safe = '' , encoding = None , errors = None ) : if ( ( isinstance ( string , str ) and ( ' ' not in string ) ) or ( isinstance ( string , bytes ) and ( ' ' not in string ) ) ) : return quote ( string , safe , encoding , errors ) if isinstance ( safe , str ) : space = ' ' else : space = ' ' string = quote ( string , ( safe + space ) , encoding , errors ) return string . replace ( ' ' , '+' )
quote the query fragment of a url; replacing with + .