def retryAssert(assertion, args, numRetries=10, sleepInterval=.1, verbose=False):

    done = False
    retries = 0
    evaluatedArgs = None
    while not done:
        try:
            evaluatedArgs = [x() for x in args]
            if verbose:
                logging.debug('trying to assert %s on %s', assertion, evaluatedArgs)
            assertion(*evaluatedArgs)
            return 
        except Exception as e:
            if retries == numRetries:
                for x in evaluatedArgs:
                    print x
                print "Failed with assertion after %s tries" % numRetries
                raise 
            if verbose:
                logging.debug('retryAssert found exception %s', traceback.format_exc(e))
            retries += 1

            time.sleep(sleepInterval)
Retries an assertion over args numRetries times. It should be
dataset/ETHPy150Open ufora/ufora/ufora/util/RetryAssert.py/retryAssert