def is_ok(func, prompt, blank='', clearline=False):
    """Prompt the user for yes/no and returns True/False

    Arguments:
    prompt -- Prompt for the user
    blank -- If True, a blank response will return True, ditto for False, the default ''
             will not accept blank responses and ask until the user gives an appropriate
             response

    Returns:
    True if user accepts, False if user does not"""
    while True:
        ok = func(prompt).lower().strip()

        if len(ok) > 0:
            if ok[0] == 'y' or ok[0] == 't' or ok[0] == '1':  # yes, true, 1
                return True
            elif ok[0] == 'n' or ok[0] == 'f' or ok[0] == '0':  # no, false, 0
                return False

        else:
            if blank is True:
                return True
            elif blank is False:
                return False