<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def wait_until(what, times=-1):
 """Wait until `what` return True Args: what (Callable[bool]):
 Call `wait()` again and again until it returns True times (int):
 Maximum times of trials before giving up Returns: True if success, False if times threshold reached """

    while times:
        logger.info('Waiting times left %d', times)
        try:
            if what() is True:
                return True
        except:
            logger.exception('Wait failed')
        else:
            logger.warning('Trial[%d] failed', times)
        times -= 1
        time.sleep(1)

    return False