def prompt_for_choice(choices, prompt=None, console=default_console, default=-1, input_kwargs=None):
    assert default < len(choices), 'Default option is great than the number of choices'
    has_default = default >= 0

    # Show options
    zero_paddings = int(math.ceil(math.log10(len(choices))))
    choice_template = '{{}}{{:{}d}}) {{}}'.format(zero_paddings)
    if has_default:
        default_prefix = '* '
        non_default_prefix = '  '
    else:
        default_prefix = non_default_prefix = ''

    for i, choice in enumerate(choices):
        console.show(choice_template.format(default_prefix if i == default else non_default_prefix, i, choice))

    # Ask
    def choice_validator(value):
        if value < len(choices):
            return value
        else:
            raise ValueError('The index is greater than the number of choices')

    input_kwargs = input_kwargs or {}
    if has_default:
        input_kwargs['default'] = default
    return console.input(prompt=prompt or 'Choose one from above options',
                         validators=[integer_validator(error_message='Choose a number'),
                                     choice_validator],
                         repeat_until_valid=True,
                         **input_kwargs)
Create a new :py:class:`tinyrpc.RPCBatchRequest` object.
dataset/ETHPy150Open sodastsai/taskr/taskr/contrib/cli.py/prompt_for_choice--crossover with--dataset/ETHPy150Open mbr/tinyrpc/tinyrpc/protocols/__init__.py/RPCBatchProtocol.create_batch_request