docs: def read_file(self, filename, force_decompress=False):
          """Read a file from the MPQ archive."""
  
          def decompress(data):
              """Read the compression type and decompress file data."""
              compression_type = ord(data[0:1])
              if compression_type == 0:
                  return data
              elif compression_type == 2:
                  return zlib.decompress(data[1:], 15)
              elif compression_type == 16:
                  return bz2.decompress(data[1:])
              else:
                  raise RuntimeError("Unsupported compression type.")
  
          hash_entry = self.get_hash_table_entry(filename)
          if hash_entry is None:
              return None
          block_entry = self.block_table[hash_entry.block_table_index]
  
          # Read the block.
          if block_entry.flags & MPQ_FILE_EXISTS:
              if block_entry.archived_size == 0:
                  return None
  
              offset = block_entry.offset + self.header['offset']
              self.file.seek(offset)
              file_data = self.file.read(block_entry.archived_size)
  
              if block_entry.flags & MPQ_FILE_ENCRYPTED:
                  raise NotImplementedError("Encryption is not supported yet.")
  
              if not block_entry.flags & MPQ_FILE_SINGLE_UNIT:
                  # File consists of many sectors. They all need to be
                  # decompressed separately and united.
                  sector_size = 512 << self.header['sector_size_shift']
                  sectors = block_entry.size // sector_size + 1
                  if block_entry.flags & MPQ_FILE_SECTOR_CRC:
                      crc = True
                      sectors += 1
                  else:
                      crc = False
                  positions = struct.unpack('<%dI' % (sectors + 1),
                                            file_data[:4*(sectors+1)])
                  result = BytesIO()
                  sector_bytes_left = block_entry.size
                  for i in range(len(positions) - (2 if crc else 1)):
                      sector = file_data[positions[i]:positions[i+1]]
                      if (block_entry.flags & MPQ_FILE_COMPRESS and
                          (force_decompress or sector_bytes_left > len(sector))):
                          sector = decompress(sector)
  
                      sector_bytes_left -= len(sector)
                      result.write(sector)
                  file_data = result.getvalue()
              else:
                  # Single unit files only need to be decompressed, but
                  # compression only happens when at least one byte is gained.
                  if (block_entry.flags & MPQ_FILE_COMPRESS and
                      (force_decompress or block_entry.size > block_entry.archived_size)):
                      file_data = decompress(file_data)
  
              return file_data