code: def _get_magic_type(self):
          
  
          try:
              with io.open(self.disk.get_fs_path(), "rb") as file:
                  file.seek(self.offset)
                  fheader = file.read(min(self.size, 4096) if self.size else 4096)
          except IOError:
              logger.exception("Failed reading first 4K bytes from volume.")
              return None
  
          # TODO fallback to img-cat image -s blocknum | file -
          # if we were able to load the module magic
          try:
              # noinspection PyUnresolvedReferences
              import magic
  
              if hasattr(magic, 'from_buffer'):
                  # using https://github.com/ahupp/python-magic
                  logger.debug("Using python-magic Python package for file type magic")
                  result = magic.from_buffer(fheader).decode()
                  self.info['magic_data'] = result
                  return result
  
              elif hasattr(magic, 'open'):
                  # using Magic file extensions by Rueben Thomas (Ubuntu python-magic module)
                  logger.debug("Using python-magic system package for file type magic")
                  ms = magic.open(magic.NONE)
                  ms.load()
                  result = ms.buffer(fheader)
                  ms.close()
                  self.info['magic_data'] = result
                  return result
  
              else:
                  logger.warning("The python-magic module is not available, but another module named magic was found.")
  
          except ImportError:
              logger.warning("The python-magic module is not available.")
          except AttributeError:
              logger.warning("The python-magic module is not available, but another module named magic was found.")
          return None
docs: Checks the volume for its magic bytes and returns the magic.