def description_of(lines, name=u'stdin'):
 u = UniversalDetector()
 for line in lines:
  u.feed(line)
 u.close()
 result = u.result
 if PY2:
  name = name.decode(sys.getfilesystemencoding(), u'ignore')
 if result[u'encoding']:
  return u'{0}: {1} with confidence {2}'.format(name, result[u'encoding'], result[u'confidence'])
 else:
  return u'{0}: no result'.format(name)

def description_of ( lines , name = u'stdin' ) : u = UniversalDetector ( ) for line in lines : u . feed ( line ) u . close ( ) result = u . result if PY2 : name = name . decode ( sys . getfilesystemencoding ( ) , u'ignore' ) if result [ u'encoding' ] : return u'{0}: {1} with confidence {2}' . format ( name , result [ u'encoding' ] , result [ u'confidence' ] ) else : return u'{0}: no result' . format ( name )
return a string describing the probable encoding of a file or list of strings .