parameters: (input_str, safe=SAFE_CHARS)
return_statement: return quote(input_str, safe=safe)
docstring: Urlencodes a string.
  
      Whereas percent_encode_sequence handles taking a dict/sequence and
      producing a percent encoded string, this function deals only with
      taking a string (not a dict/sequence) and percent encoding it.
  
      If given the binary type, will simply URL encode it. If given the
      text type, will produce the binary type by UTF-8 encoding the
      text. If given something else, will convert it to the text type
      first.
docstring_summary: Urlencodes a string.
docstring_tokens: Urlencodes a string .
function: def percent_encode(input_str, safe=SAFE_CHARS):
      """Urlencodes a string.
  
      Whereas percent_encode_sequence handles taking a dict/sequence and
      producing a percent encoded string, this function deals only with
      taking a string (not a dict/sequence) and percent encoding it.
  
      If given the binary type, will simply URL encode it. If given the
      text type, will produce the binary type by UTF-8 encoding the
      text. If given something else, will convert it to the text type
      first.
      """
      # If its not a binary or text string, make it a text string.
      if not isinstance(input_str, (six.binary_type, six.text_type)):
          input_str = six.text_type(input_str)
      # If it's not bytes, make it bytes by UTF-8 encoding it.
      if not isinstance(input_str, six.binary_type):
          input_str = input_str.encode('utf-8')
      return quote(input_str, safe=safe)
function_tokens: def percent_encode ( input_str , safe = SAFE_CHARS ) : # If its not a binary or text string, make it a text string. if not isinstance ( input_str , ( six . binary_type , six . text_type ) ) : input_str = six . text_type ( input_str ) # If it's not bytes, make it bytes by UTF-8 encoding it. if not isinstance ( input_str , six . binary_type ) : input_str = input_str . encode ( 'utf-8' ) return quote ( input_str , safe = safe )