def encode_cookie_value(data, quote=default_cookie_quote):
 if (data is None):
  return None
 if (not isinstance(data, bytes)):
  data = data.encode('utf-8')
 quoted = quote(data)
 return quoted

def encode_cookie_value ( data , quote = default_cookie_quote ) : if ( data is None ) : return None if ( not isinstance ( data , bytes ) ) : data = data . encode ( 'utf-8' ) quoted = quote ( data ) return quoted
url-encode strings to make them safe for a cookie value .