def query_yes_no(question, default="<STR_LIT:yes>"):
valid = {"<STR_LIT:yes>": Answers.YES, "<STR_LIT:y>": Answers.YES,  "<STR_LIT>": Answers.YES,<EOL>"<STR_LIT>": Answers.NO,   "<STR_LIT:n>": Answers.NO}<EOL>if default is None:<EOL><INDENT>prompt = "<STR_LIT>"<EOL><DEDENT>elif default == "<STR_LIT:yes>":<EOL><INDENT>prompt = "<STR_LIT>"<EOL><DEDENT>elif default == "<STR_LIT>":<EOL><INDENT>prompt = "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>" % default)<EOL><DEDENT>while True:<EOL><INDENT>sys.stdout.write(question + prompt)<EOL>choice = input().lower()<EOL>if default is not None and choice == '<STR_LIT>':<EOL><INDENT>return valid[default]<EOL><DEDENT>elif choice in valid:<EOL><INDENT>return valid[choice]<EOL><DEDENT>else:<EOL><INDENT>sys.stdout.write("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT><DEDENT>
Ask a yes/no question via raw_input() and return their answer.

    "question" is a string that is presented to the user.
    "default" is the presumed answer if the user just hits <Enter>.
        It must be "yes" (the default), "no" or None (meaning
        an answer is required of the user).

    The return value is one of Answers.YES or Answers.NO.

    Copied (and modified) from
    http://stackoverflow.com/questions/3041986/python-command-line-yes-no-input