code: def guess_format(path):
      
      for fmt in formats:
          if fmt.verify(path):
              return fmt.__name__
      else:
          msg = "Undefined file format: '{}'".format(path)
          raise UnknownFileFormatError(msg)
docs: Determine the file format of a folder or a file