def METHOD_NAME(state, player):
    return (((state.has("HM02 Fly", player) and can_learn_hm(state, "Fly", player)) or state.has("Flute", player)) and
           (state.has("Thunder Badge", player) or state.has(state.multiworld.worlds[player].extra_badges.get("Fly"), player)
            or state.multiworld.badges_needed_for_hm_moves[player].value == 0))