from funcy import iterate, first def until(cond, func, *args, **kwargs): return first(filter(cond, iterate(func, *args, **kwargs)))