code: def encoding(self):
          
          if hasattr(self, '_encoding'):
              return self._encoding
  
          # content is unicode
          if isinstance(self.content, six.text_type):
              return 'unicode'
  
          # Try charset from content-type or content
          encoding = get_encoding(self.headers, self.content)
  
          # Fallback to auto-detected encoding.
          if not encoding and chardet is not None:
              encoding = chardet.detect(self.content[:600])['encoding']
  
          if encoding and encoding.lower() == 'gb2312':
              encoding = 'gb18030'
  
          self._encoding = encoding or 'utf-8'
          return self._encoding
docs: encoding of Response.content.
  
          if Response.encoding is None, encoding will be guessed
          by header or content or chardet if available.