Automatically detects given string's encoding and returns its unicode form.
    Decoding errors are handled according to the `errors` argument, see `unicode()`
    documentation for more details.

    :param s: string to decode.
    :type s: str
    :param errors: decoding error handling behaviour.
    :type errors: str
    :return: decoded string
    :rtype: unicode

def u(s, errors='ignore'):
    """
    Automatically detects given string's encoding and returns its unicode form.
    Decoding errors are handled according to the `errors` argument, see `unicode()`
    documentation for more details.

    :param s: string to decode.
    :type s: str
    :param errors: decoding error handling behaviour.
    :type errors: str
    :return: decoded string
    :rtype: unicode
    """
    try:
        return s.decode('utf-8', errors=errors)
    except UnicodeDecodeError:
        encoding = chardet.detect(s)['encoding']
        return unicode(s, encoding=encoding, errors=errors)