def description_of(lines, name='stdin'):
    '\n    Return a string describing the probable encoding of a file or\n    list of strings.\n\n    :param lines: The lines to get the encoding of.\n    :type lines: Iterable of bytes\n    :param name: Name of file or collection of lines\n    :type name: str\n    '
    u = UniversalDetector()
    for line in lines:
        line = bytearray(line)
        u.feed(line)
        if u.done:
            break
    u.close()
    result = u.result
    if PY2:
        name = name.decode(sys.getfilesystemencoding(), 'ignore')
    if result['encoding']:
        return '{0}: {1} with confidence {2}'.format(name, result['encoding'], result['confidence'])
    else:
        return '{0}: no result'.format(name)
Return a string describing the probable encoding of a file or
list of strings.

:param lines: The lines to get the encoding of.
:type lines: Iterable of bytes
:param name: Name of file or collection of lines
:type name: str
def description_of(lines, name='stdin'):
    '\n    Return a string describing the probable encoding of a file or\n    list of strings.\n\n    :param lines: The lines to get the encoding of.\n    :type lines: Iterable of bytes\n    :param name: Name of file or collection of lines\n    :type name: str\n    '
    u = UniversalDetector()
    for line in lines:
        line = bytearray(line)
        u.feed(line)
        if u.done:
            break
    u.close()
    result = u.result
    if PY2:
        name = name.decode(sys.getfilesystemencoding(), 'ignore')
    if result['encoding']:
        return '{0}: {1} with confidence {2}'.format(name, result['encoding'], result['confidence'])
    else:
        return '{0}: no result'.format(name)