'Wait for event to happen.
The `catch` argument specifies the exception that means the event
has not happened yet.'

def wait_for(self, fun, catch, desc=u'thing', args=(), kwargs={}, errback=None, max_retries=10, interval_start=0.1, interval_step=0.5, interval_max=5.0, emit_warning=False, **options):

    def on_error(exc, intervals, retries):
        interval = next(intervals)
        if emit_warning:
            self.warn(E_STILL_WAITING.format(desc, when=humanize_seconds(interval, u'in', u'    '), exc=exc))
        if errback:
            errback(exc, interval, retries)
        return interval
    return self.retry_over_time(fun, catch, args=args, kwargs=kwargs, errback=on_error, max_retries=max_retries, interval_start=interval_start, interval_step=interval_step, **options)
