def choose_multiple(somelist, chosen=None, prompt="choose multiple", input=raw_input, error=default_error):
    somelist = somelist[:]
    if chosen is None:
        chosen = []
    while 1:
        print( "Choose from list. Enter to end, negative index removes from chosen.")
        print_menu_list(somelist)
        if chosen:
            print("You have: ")
            print_menu_list(chosen)
        try:
            ri = get_input(prompt, None, input) # menu list starts at one
        except EOFError:
            return chosen
        if not ri:
            return chosen
        try:
            idx = int(ri)
        except ValueError:
            error("Bad selection. Type in the number.")
            continue
        else:
            if idx < 0:
                idx = -idx - 1
                try:
                    somelist.append(chosen[idx])
                    del chosen[idx]
                except __HOLE__:
                    error("Selection out of range.")
            elif idx == 0:
                error("No zero.")
            else:
                try:
                    chosen.append(somelist[idx-1])
                    del somelist[idx-1]
                except IndexError:
                    error("Selection out of range.")
dataset/ETHPy150Open kdart/pycopia/core/pycopia/cliutils.py/choose_multiple