code: def decode(self, text):
          
          # only decode byte strings into unicode if it hasn't already
          # been done by a subclass
          if isinstance(text, six.text_type):
              return text
  
          # empty text? nothing to decode
          if not text:
              return u''
  
          # use chardet to automatically detect the encoding text
          result = chardet.detect(text)
          return text.decode(result['encoding'])
docs: Decode ``text`` using the `chardet
          <https://github.com/chardet/chardet>`_ package.