parameters: (r)
docstring: Returns the requested content back in unicode.
  
      :param r: Response object to get unicode content from.
  
      Tried:
  
      1. charset from content-type
      2. fall back and replace all unicode characters
  
      :rtype: str
docstring_summary: Returns the requested content back in unicode.
docstring_tokens: Returns the requested content back in unicode .
function: def get_unicode_from_response(r):
      """Returns the requested content back in unicode.
  
      :param r: Response object to get unicode content from.
  
      Tried:
  
      1. charset from content-type
      2. fall back and replace all unicode characters
  
      :rtype: str
      """
      warnings.warn((
          'In requests 3.0, get_unicode_from_response will be removed. For '
          'more information, please see the discussion on issue #2266. (This'
          ' warning should only appear once.)'),
          DeprecationWarning)
  
      tried_encodings = []
  
      # Try charset from content-type
      encoding = get_encoding_from_headers(r.headers)
  
      if encoding:
          try:
              return str(r.content, encoding)
          except UnicodeError:
              tried_encodings.append(encoding)
  
      # Fall back:
      try:
          return str(r.content, encoding, errors='replace')
      except TypeError:
          return r.content
function_tokens: def get_unicode_from_response ( r ) : warnings . warn ( ( 'In requests 3.0, get_unicode_from_response will be removed. For ' 'more information, please see the discussion on issue #2266. (This' ' warning should only appear once.)' ) , DeprecationWarning ) tried_encodings = [ ] # Try charset from content-type encoding = get_encoding_from_headers ( r . headers ) if encoding : try : return str ( r . content , encoding ) except UnicodeError : tried_encodings . append ( encoding ) # Fall back: try : return str ( r . content , encoding , errors = 'replace' ) except TypeError : return r . content