

def yesno(question, default=None, all=False):
    if (default is True):
        question = ('%s [Yes/no' % question)
        answers = {
            False: ('n', 'no'),
            True: ('', 'y', 'yes'),
        }
    elif (default is False):
        question = ('%s [yes/No' % question)
        answers = {
            False: ('', 'n', 'no'),
            True: ('y', 'yes'),
        }
    else:
        question = ('%s [yes/no' % question)
        answers = {
            False: ('n', 'no'),
            True: ('y', 'yes'),
        }
    if all:
        if (default is 'all'):
            answers['all'] = ('', 'a', 'all')
            question = ('%s/All' % question)
        else:
            answers['all'] = ('a', 'all')
            question = ('%s/all' % question)
    question = ('%s] ' % question)
    while 1:
        answer = get_input(question).lower()
        for option in answers:
            if (answer in answers[option]):
                return option
        if all:
            print('You have to answer with y, yes, n, no, a or all.', file=sys.stderr)
        else:
            print('You have to answer with y, yes, n or no.', file=sys.stderr)

dataset/ETHPy150Open ployground/ploy/ploy/common.py yesno/original