def guess_file_type(self, path): if not hasattr(self, '_mimedb'): self._mimedb = magic.Magic() return maybe_decode(self._mimedb.from_file(path))