def METHOD_NAME(self, model: Bpc) -> bytes:
    assert 0 < model.number_of_layers < 3
    # First collect tiles and tilemaps for both layers, so we can calculate
    # the pointers
    tiles = []
    tilemaps = []
    for i in range(0, model.number_of_layers):
        tiles.append(self._convert_tiles(model, i))
        tilemaps.append(self._convert_tilemap(model, i))
    end_of_layer_specs = u16_checked(4 + (12 * model.number_of_layers))
    length_of_first_layer = len(tiles[0]) + len(tilemaps[0])
    # The length is increased by 1 if a padding has to be added:
    if (end_of_layer_specs + len(tiles[0])) % 2 != 0:
        length_of_first_layer += 1
    if (end_of_layer_specs + length_of_first_layer) % 2 != 0:
        length_of_first_layer += 1
    length_of_second_layer = 0
    if model.number_of_layers > 1:
        length_of_second_layer = len(tiles[1]) + len(tilemaps[1])
        # The length is increased by 1 if a padding has to be added:
        if (end_of_layer_specs + length_of_first_layer + len(tiles[1])) % 2 != 0:
            length_of_second_layer += 1
        if (end_of_layer_specs + length_of_second_layer) % 2 != 0:
            length_of_second_layer += 1
    # 4 byte header + layer specs + layer data
    data = bytearray(
        end_of_layer_specs + length_of_first_layer + length_of_second_layer
    )
    # upper layer pointer
    self._write_16uintle(data, end_of_layer_specs)
    # lower layer pointer ( if two layers )
    if model.number_of_layers > 1:
        self._write_16uintle(
            data, u16_checked(end_of_layer_specs + length_of_first_layer)
        )
    else:
        self._write_16uintle(data, u16(0))
    # for each layer specs:
    for i in range(0, model.number_of_layers):
        # number tiles + 1
        self._write_16uintle(data, u16_checked(model.layers[i].number_tiles + 1))
        # bpa1-4
        self._write_16uintle(data, model.layers[i].bpas[0])
        self._write_16uintle(data, model.layers[i].bpas[1])
        self._write_16uintle(data, model.layers[i].bpas[2])
        self._write_16uintle(data, model.layers[i].bpas[3])
        # tilemap length
        self._write_16uintle(data, model.layers[i].chunk_tilemap_len)
    # for each layer:
    for i in range(0, model.number_of_layers):
        # tiles
        lentiles = len(tiles[i])
        data[self.bytes_written : self.bytes_written + lentiles] = tiles[i]
        self.bytes_written += lentiles
        # 2 bytes alignment
        if self.bytes_written % 2 != 0:
            data[self.bytes_written] = 0
            self.bytes_written += 1
        # tilemap
        lentilemap = len(tilemaps[i])
        data[self.bytes_written : self.bytes_written + lentilemap] = tilemaps[i]
        self.bytes_written += lentilemap
        # 2 bytes alignment
        if self.bytes_written % 2 != 0:
            data[self.bytes_written] = 0
            self.bytes_written += 1
    return data