def choose_value(somemap, default=None, prompt="choose", input=raw_input, error=default_error):
    """Select an item from a mapping. Keys are indexes that are selected.
    Returns the value of the mapping key selected.
    """
    first = print_menu_map(somemap)
    while 1:
        try:
            ri = get_input(prompt, default, input)
        except EOFError:
            return default
        if not ri:
            return default
        try:
            idx = type(first)(ri)
        except __HOLE__:
            error("Not a valid entry. Please try again.")
            continue

        if idx not in somemap:
            error("Not a valid selection. Please try again.")
            continue
        return somemap[idx]
dataset/ETHPy150Open kdart/pycopia/core/pycopia/cliutils.py/choose_value