def user_input(text: 'str', choices: 'Iterable[str]', default: 'str'=None,
    selection: 'str'='') ->'str':
    """ Default can be a selection from choice and allows empty input. """
    while True:
        selection = input(text).strip().lower()
        if selection != '' and selection in choices:
            break
        if selection == '' and default is not None:
            selection = default
            break
    return selection
