def choose(io, somelist, defidx=0, prompt="choose"):
    """Select an item from a list."""
    if len(somelist) == 0:
        return None

    root = io.root
    root.bottom()
    py, px = io.getmaxyx()

    outwin = io.derwin(py-3,px-10, 3,5)
    outwin.box()
    outwin.refresh()
    win = outwin.derwin(py-5,px-12, 1,1)
    panel = curses.panel.new_panel(outwin)

    print_menu_list(somelist, win, py)
    panel.top()
    panel.show()

    defidx = int(defidx)
    if 0 < defidx:
        defidx = 0
    if defidx >= len(somelist):
        defidx = len(somelist)-1
    try:
        try:
            ri = get_input(io, prompt, defidx+1) # menu list starts at one
        except EOFError:
            return None
        if ri:
            try:
                idx = int(ri)-1
            except ValueError:
                io.errlog("Bad selection. Type in the number.")
                return None
            else:
                try:
                    return somelist[idx]
                except IndexError:
                    io.errlog("Bad selection. Selection out of range.")
                    return None
        else:
            return None
    finally:
        panel.hide()
        win.erase() ; outwin.clear()
        root.show()
dataset/ETHPy150Open kdart/pycopia/CLI/pycopia/cursesio.py/choose/swapped operands of `<`