def cleaned_string(val):
 return urllib.quote_plus(smart_str(val))

def cleaned_string ( val ) : return urllib . quote_plus ( smart_str ( val ) )
converts val to unicode and url-encodes special characters .