def description_of(lines, name='<STR_LIT>'):
u = UniversalDetector()<EOL>for line in lines:<EOL><INDENT>line = bytearray(line)<EOL>u.feed(line)<EOL>if u.done:<EOL><INDENT>break<EOL><DEDENT><DEDENT>u.close()<EOL>result = u.result<EOL>if PY2:<EOL><INDENT>name = name.decode(sys.getfilesystemencoding(), '<STR_LIT:ignore>')<EOL><DEDENT>if result['<STR_LIT>']:<EOL><INDENT>return '<STR_LIT>'.format(name, result['<STR_LIT>'],<EOL>result['<STR_LIT>'])<EOL><DEDENT>else:<EOL><INDENT>return '<STR_LIT>'.format(name)<EOL><DEDENT>
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