def query_yes_no(question, default='<STR_LIT:yes>'):
valid = {'<STR_LIT:yes>': True, '<STR_LIT:y>': True, '<STR_LIT>': True,<EOL>'<STR_LIT>': False, '<STR_LIT:n>': False}<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.stderr.write(question + prompt)<EOL>choice = raw_input().strip().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.stderr.write('<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 'answer' return value is one of 'yes' or 'no'.