def METHOD_NAME(target):
    timeout = 10.0
    start = time.time()
    while ((time.time() - start) < timeout):
        s.poll()
        if s.task_mode == target:
            return
        time.sleep(0.1)
    log("timeout waiting for task mode to get to  %d (it's %d)" % (target, s.task_mode))
    sys.exit(1)