def poll(poller, *args, **kwargs):
    timeout = 10
    if 'timeout' in kwargs:
        timeout = kwargs['timeout']
        kwargs.pop('timeout')
    success = False
    with gevent.timeout.Timeout(timeout):
        while not success:
            success = poller(*args, **kwargs)
            gevent.sleep(0.2)
    return success
Polls a callback (poller) until success is met
dataset/ETHPy150Open ooici/pyon/pyon/util/poller.py/poll