'Wait a fixed time until the condition is true.'

def WaitUntil(self, condition_cb, timeout=5):

    for _ in xrange(int((timeout / self.sleep_time))):
        res = condition_cb()
        if res:
            return res
        time.sleep(self.sleep_time)
    raise RuntimeError('Timeout    exceeded.    Condition    not    true')
