def ask(question, options, default):
assert default in options<EOL>question += "<STR_LIT>".format("<STR_LIT:/>".join(o.upper() if o == default else o for o in options))<EOL>selected = None<EOL>while selected not in options:<EOL><INDENT>selected = input(question).strip().lower()<EOL>if selected == "<STR_LIT>":<EOL><INDENT>selected = default<EOL><DEDENT>else:<EOL><INDENT>if selected not in options:<EOL><INDENT>question = "<STR_LIT>".format(<EOL>"<STR_LIT>".join(options[:-<NUM_LIT:1>]), options[-<NUM_LIT:1>],<EOL>comma='<STR_LIT:U+002C>' if len(options) > <NUM_LIT:2> else '<STR_LIT>',<EOL>)<EOL><DEDENT><DEDENT><DEDENT>return selected<EOL>
Ask the user a question with a list of allowed answers (like yes or no).

The user is presented with a question and asked to select an answer from
the given options list. The default will be returned if the user enters
nothing. The user is asked to repeat his answer if his answer does not
match any of the allowed anwsers.

:param    question: Question to present to the user (without question mark)
:type     question: ``str``

:param    options: List of allowed anwsers
:type     options: ``list``

:param    default: Default answer (if the user enters no text)
:type     default: ``str``