def _parse_chunk_headers(self):
        for x in range(32):
            for z in range(32):
                m = self.metadata[x, z]
                if m.status not in (STATUS_CHUNK_OK, STATUS_CHUNK_OVERLAPPING, \
                                    STATUS_CHUNK_MISMATCHED_LENGTHS):
                    # skip to next if status is NOT_CREATED, OUT_OF_FILE, IN_HEADER,
                    # ZERO_LENGTH or anything else.
                    continue
                try:
                    self.file.seek(m.blockstart*SECTOR_LENGTH) # offset comes in sectors of 4096 bytes
                    length = unpack(">I", self.file.read(4))
                    m.length = length[0] # unpack always returns a tuple, even unpacking one element
                    compression = unpack(">B",self.file.read(1))
                    m.compression = compression[0]
                except __HOLE__:
                    m.status = STATUS_CHUNK_OUT_OF_FILE
                    continue
                if m.blockstart*SECTOR_LENGTH + m.length + 4 > self.size:
                    m.status = STATUS_CHUNK_OUT_OF_FILE
                elif m.length <= 1: # chunk can't be zero length
                    m.status = STATUS_CHUNK_ZERO_LENGTH
                elif m.length + 4 > m.blocklength * SECTOR_LENGTH:
                    # There are not enough sectors allocated for the whole block
                    m.status = STATUS_CHUNK_MISMATCHED_LENGTHS
dataset/ETHPy150Open twoolie/NBT/nbt/region.py/RegionFile._parse_chunk_headers