code: def _magic(header, footer, mime, ext=None):
      
      if not header:
          raise ValueError("Input was empty")
      info = _identify_all(header, footer, ext)[0]
      if mime:
          return info.mime_type
      return info.extension if not \
          isinstance(info.extension, list) else info[0].extension
docs: Discover what type of file it is based on the incoming string