def upsidedown_game(g, smallmap=False, flipbuttons=False, flipsounds=False):
    last_sprite = 256 if smallmap else 128
    for id in range(last_sprite):
        sprite = g.gfx.get_sprite(id)
        flipped_sprite = reversed(list(reversed(row) for row in sprite))
        g.gfx.set_sprite(id, flipped_sprite)

    last_map_row = 32 if smallmap else 64
    tile_rect = g.map.get_rect_tiles(0, 0, 128, last_map_row)
    flipped_map = reversed(list(reversed(row) for row in tile_rect))
    g.map.set_rect_tiles(flipped_map, 0, 0)

    if flipsounds:
        for id in range(63):
            notes = [g.sfx.get_note(id, n) for n in range(32)]
            notes.reverse()
            for n in range(32):
                g.sfx.set_note(id, n, *notes[n])
            (editor_mode, note_duration, loop_start, loop_end) = g.sfx.get_properties(id)
            if loop_start:
                g.sfx.set_properties(id, loop_start=63-loop_end)
            if loop_end:
                g.sfx.set_properties(id, loop_end=63-loop_start)

    transform = UpsideDownASTTransform(g.lua.tokens, g.lua.root,
                                       smallmap=smallmap,
                                       flipbuttons=flipbuttons)
    try:
        it = transform.walk()
        while True:
            it.__next__()
    except StopIteration:
        pass
To be called in delete_router() BEFORE router has been
dataset/ETHPy150Open dansanderson/picotool/pico8/demos/upsidedown.py/upsidedown_game--crossover with--dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/plugins/cisco/db/l3/ha_db.py/HA_db_mixin._delete_redundancy_routers