def METHOD_NAME(
    md_target: MdEntryProtocol,
    *,
    md_gender1: MdEntryProtocol,
    md_gender2: Optional[MdEntryProtocol],
    monster_bin: BinPack,
    sprite_size_table: List[MonsterSpriteDataTableEntry],
    is_expand_poke_list_patch_applied: bool = False,
) -> bool:
    """
    Check that the data in the Pokémon sprite-size metadata
    table matches the currently selected sprite of the Pokémon.
    If not, change the value and save it.
    Arguments:
        - md_target: The MD entry to modify. This should be one of `md_gender1` or `md_gender2`.
        - md_gender1: The primary gender entry.
        - md_gender2: The secondary gender entry or None.
        - monster_bin: monster.bin sprite file
        - sprite_size_table: Sprite size metadata table
        - is_expand_poke_list_patch_applied: Whether ExpandPokeList is applied.
    Returns True if a change was performed.
    If changes were performed the data in the following input parameters may be modified and should
    be written back to ROM:
    - md_target
    - sprite_size_table
    """
    changed = False
    effective_base_attr = "md_index_base"
    # If ExpandPokeList is applied, unk17 and unk18 are the values used instead
    if is_expand_poke_list_patch_applied:
        effective_base_attr = "entid"
        check_value = md_target.unk17
        check_value_file = md_target.unk18
        max_tile_slots_needed, max_file_size_needed = _get_sprite_properties(
            monster_bin, md_target
        )
    else:
        check_value = sprite_size_table[md_gender1.md_index_base].sprite_tile_slots
        check_value_file = sprite_size_table[md_gender1.md_index_base].unk1
        max_tile_slots_needed, max_file_size_needed = _get_sprite_properties(
            monster_bin, md_gender1
        )
        if md_gender2 is not None:
            max_tile_slots_needed2, max_file_size_needed2 = _get_sprite_properties(
                monster_bin, md_gender2
            )
            max_tile_slots_needed = max(max_tile_slots_needed, max_tile_slots_needed2)
            max_file_size_needed = max(max_file_size_needed, max_file_size_needed2)
    if check_value != max_tile_slots_needed:
        if is_expand_poke_list_patch_applied:
            md_target.unk17 = max_tile_slots_needed
        else:
            sprite_size_table[
                getattr(md_gender1, effective_base_attr)
            ].sprite_tile_slots = max_tile_slots_needed
        changed = True
    if check_value_file != max_file_size_needed:
        if is_expand_poke_list_patch_applied:
            md_target.unk18 = max_file_size_needed
        else:
            sprite_size_table[
                getattr(md_gender1, effective_base_attr)
            ].unk1 = max_file_size_needed
        changed = True
    return changed