def read_string ( cls , string ) : if PY3 and not isinstance ( string , byte_types ) : string = string . encode ( ) return cls . decode ( string )
python decode byte string var
Decodes a given bencoded string or bytestring .
def read_string(cls, string):
        """Decodes a given bencoded string or bytestring.

        Returns decoded structure(s).

        :param str string:
        :rtype: list
        """
        if PY3 and not isinstance(string, byte_types):
            string = string.encode()

        return cls.decode(string)