(s, encoding='utf-8', errors='strict')
return s
Returns a unicode object representing 's'.  Treats bytestrings using
    the 'encoding' codec.

    :param s: one string
    :param encoding: the input encoding
    :param errors: values that are accepted by Python’s unicode() function
                   for its error handling
Returns a unicode object representing 's'.  Treats bytestrings using
    the 'encoding' codec.
Returns a unicode object representing s . Treats bytestrings using the encoding codec .
def force_text(s, encoding='utf-8', errors='strict'):
    """Returns a unicode object representing 's'.  Treats bytestrings using
    the 'encoding' codec.

    :param s: one string
    :param encoding: the input encoding
    :param errors: values that are accepted by Python’s unicode() function
                   for its error handling
    """
    if isinstance(s, text_type):
        return s

    try:
        if not isinstance(s, string_types):
            if not PY2:
                if isinstance(s, bytes):
                    s = text_type(s, encoding, errors)
                else:
                    s = text_type(s)
            elif hasattr(s, '__unicode__'):
                s = s.__unicode__()
            else:
                s = text_type(bytes(s), encoding, errors)
        else:
            s = s.decode(encoding, errors)
    except UnicodeDecodeError as e:
        if not isinstance(s, Exception):
            raise SenderUnicodeDecodeError(s, *e.args)
        else:
            s = ' '.join([force_text(arg, encoding, errors) for arg in s])
    return s
def force_text ( s , encoding = 'utf-8' , errors = 'strict' ) : if isinstance ( s , text_type ) : return s try : if not isinstance ( s , string_types ) : if not PY2 : if isinstance ( s , bytes ) : s = text_type ( s , encoding , errors ) else : s = text_type ( s ) elif hasattr ( s , '__unicode__' ) : s = s . __unicode__ ( ) else : s = text_type ( bytes ( s ) , encoding , errors ) else : s = s . decode ( encoding , errors ) except UnicodeDecodeError as e : if not isinstance ( s , Exception ) : raise SenderUnicodeDecodeError ( s , * e . args ) else : s = ' ' . join ( [ force_text ( arg , encoding , errors ) for arg in s ] ) return s