def try_for(fn, timeout=5.0, delay=0.1):
    
    until = time.time() + timeout
    v = fn()
    while not v and time.time() < until:
        time.sleep(delay)
        v = fn()
    return v
Test grouping of period events
dataset/ETHPy150Open dokipen/whoosh/src/whoosh/support/filelock.py/try_for--crossover with--dataset/ETHPy150Open sahana/eden/modules/unit_tests/s3/s3timeplot.py/PeriodTests.testGrouping