def parse(self, fp):
    try:
        self._fp = fp
        self._fp.seek((- 32), os.SEEK_END)
        trailer = self._fp.read(32)
        if (len(trailer) != 32):
            raise InvalidFileException()
        (offset_size, self._ref_size, num_objects, top_object, offset_table_offset) = struct.unpack('>6xBBQQQ', trailer)
        self._fp.seek(offset_table_offset)
        self._object_offsets = self._read_ints(num_objects, offset_size)
        self._objects = ([_undefined] * num_objects)
        return self._read_object(top_object)
    except (OSError, IndexError, struct.error, OverflowError, UnicodeDecodeError):
        raise InvalidFileException()
def parse(self, fp):
    try:
        self._fp = fp
        self._fp.seek((- 32), os.SEEK_END)
        trailer = self._fp.read(32)
        if (len(trailer) != 32):
            raise InvalidFileException()
        (offset_size, self._ref_size, num_objects, top_object, offset_table_offset) = struct.unpack('>6xBBQQQ', trailer)
        self._fp.seek(offset_table_offset)
        self._object_offsets = self._read_ints(num_objects, offset_size)
        self._objects = ([_undefined] * num_objects)
        return self._read_object(top_object)
    except (OSError, IndexError, struct.error, OverflowError, UnicodeDecodeError):
        raise InvalidFileException()