def METHOD_NAME(timeout, interval, delay, condition, *args, **kwargs):
    log_debug("Wait until %s is True, timeout is %s seconds, checking interval is %s, delay is %s seconds" %
              (condition.__name__, timeout, interval, delay))
    if delay > 0:
        log_debug("Delay for %s seconds first" % delay)
        time.sleep(delay)
    start_time = time.time()
    elapsed_time = 0
    while elapsed_time < timeout:
        log_debug("Time elapsed: %f seconds" % elapsed_time)
        try:
            check_result = condition(*args, **kwargs)
        except Exception as e:
            exc_info = sys.exc_info()
            details = traceback.format_exception(*exc_info)
            log_error(
                "Exception caught while checking {}:{}, error:{}".format(
                    condition.__name__, "".join(details), e
                )
            )
            check_result = False
        if check_result:
            log_debug("%s is True, exit early with True" % condition.__name__)
            return True
        else:
            log_debug("%s is False, wait %d seconds and check again" % (condition.__name__, interval))
            time.sleep(interval)
            elapsed_time = time.time() - start_time
    log_debug("%s is still False after %d seconds, exit with False" % (condition.__name__, timeout))
    return False