code: def description_of(lines, name='stdin'):
      
      u = UniversalDetector()
      for line in lines:
          line = bytearray(line)
          u.feed(line)
          # shortcut out of the loop to save reading further - particularly useful if we read a BOM.
          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)
docs: 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