def decode(self, text):
        """Decode ``text`` using the `chardet
        <https://github.com/chardet/chardet>`_ package.
        """
        # 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'])
def decode ( self , text ) : if isinstance ( text , six . text_type ) : return text if not text : return u'' result = chardet . detect ( text ) return text . decode ( result [ 'encoding' ] )
Decode ``text`` using the `chardet
        <https://github.com/chardet/chardet>`_ package.