def ask(question, default=True, exact=False):
if AUTO_RESPONSE:<EOL><INDENT>if default is None:<EOL><INDENT>msg = ("<STR_LIT>" +<EOL>"<STR_LIT>")<EOL>msg = msg % question<EOL>raise RuntimeError(msg)<EOL><DEDENT>logger.debug("<STR_LIT>" % (<EOL>default and "<STR_LIT:yes>" or "<STR_LIT>"))<EOL>logger.debug(question)<EOL>return default<EOL><DEDENT>while True:<EOL><INDENT>yn = '<STR_LIT>'<EOL>if default is True:<EOL><INDENT>yn = '<STR_LIT>'<EOL><DEDENT>if default is False:<EOL><INDENT>yn = '<STR_LIT>'<EOL><DEDENT>q = question + "<STR_LIT>" % yn<EOL>answer = input(q)<EOL>if answer:<EOL><INDENT>answer = answer<EOL><DEDENT>else:<EOL><INDENT>answer = '<STR_LIT>'<EOL><DEDENT>if not answer and default is not None:<EOL><INDENT>return default<EOL><DEDENT>if exact and answer.lower() not in ('<STR_LIT:yes>', '<STR_LIT>'):<EOL><INDENT>print("<STR_LIT>"<EOL>"<STR_LIT>")<EOL>continue<EOL><DEDENT>if answer:<EOL><INDENT>answer = answer[<NUM_LIT:0>].lower()<EOL>if answer == '<STR_LIT:y>':<EOL><INDENT>return True<EOL><DEDENT>if answer == '<STR_LIT:n>':<EOL><INDENT>return False<EOL><DEDENT><DEDENT>print('<STR_LIT>')<EOL>continue<EOL><DEDENT>
Ask the question in y/n form and return True/False.

    If you don't want a default 'yes', set default to None (or to False if you
    want a default 'no').

    With exact=True, we want to get a literal 'yes' or 'no', at least
    when it does not match the default.