def ask_yes_no(question, default=True):
    """
    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 True or False.
    """
    valid = {'yes': True, 'y': True, 'ye': True, 'no': False, 'n': False}
    if default is None:
        prompt = ' [y/n] '
    elif default is True:
        prompt = ' [Y/n] '
    elif default is False:
        prompt = ' [y/N] '
    else:
        raise ValueError('invalid default answer: `%s`' % default)
    while True:
        choice = input(question + prompt).strip().lower()
        print()
        if default is not None and choice == '':
            return default
        elif choice in valid.keys():
            return valid[choice]
        else:
            print('Please respond with `yes` or `no`.')
