def ask_bool(prompt):
    'Ask a question to the user, retry until the reply is valid'
    while True:
        try:
            return strtobool(input(('%s (yes/no) ' % prompt)).strip().casefold())
        except ValueError:
            continue
Ask a question to the user, retry until the reply is valid
def ask_bool(prompt):
    
    while True:
        try:
            return strtobool(input(('%s (yes/no) ' % prompt)).strip().casefold())
        except ValueError:
            continue