(text, encoding=None, errors='strict')
return text.decode(encoding, errors)
Return the unicode representation of a bytes object ``text``. If
    ``text`` is already an unicode object, return it as-is.
Return the unicode representation of a bytes object ``text``. If
    ``text`` is already an unicode object, return it as-is.
Return the unicode representation of a bytes object text . If text is already an unicode object return it as - is .
def to_unicode(text, encoding=None, errors='strict'):
    """Return the unicode representation of a bytes object ``text``. If
    ``text`` is already an unicode object, return it as-is."""
    if isinstance(text, str):
        return text
    if not isinstance(text, (bytes, str)):
        raise TypeError('to_unicode must receive a bytes or str '
                        f'object, got {type(text).__name__}')
    if encoding is None:
        encoding = 'utf-8'
    return text.decode(encoding, errors)
def to_unicode ( text , encoding = None , errors = 'strict' ) : if isinstance ( text , str ) : return text if not isinstance ( text , ( bytes , str ) ) : raise TypeError ( 'to_unicode must receive a bytes or str ' f'object, got {type(text).__name__}' ) if encoding is None : encoding = 'utf-8' return text . decode ( encoding , errors )