def prompt_for_yn(prompt_str, default=None):
    if default == True:
        prompt = prompt_str + ' [Y/n]: '
    elif default == False:
        prompt = prompt_str + ' [y/N]: '
    else:
        prompt = prompt_str + ' [y/n]: '

    while True:
        try:
            value = input(prompt)
        except __HOLE__:
            print('')
            exit(1)
        except EOFError:
            print('')
            exit(1)
        if value != '':
            if value.lower()[0] == 'y':
                return True
            elif value.lower()[0] == 'n':
                return False
            else:
                print('Error: unrecognized response')
        elif default is not None:
            return default
dataset/ETHPy150Open dnanexus/dx-toolkit/src/python/dxpy/cli/__init__.py/prompt_for_yn