def retry(tries, delay=<NUM_LIT:3>, backoff=<NUM_LIT:2>):
if backoff <= <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>tries = math.floor(tries)<EOL>if tries < <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if delay <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>def deco_retry(f):<EOL><INDENT>def f_retry(*args, **kwargs):<EOL><INDENT>mtries, mdelay = tries, delay<EOL>rv = f(*args, **kwargs)  <EOL>while mtries > <NUM_LIT:0>:<EOL><INDENT>if rv is True:<EOL><INDENT>return True<EOL><DEDENT>mtries -= <NUM_LIT:1><EOL>time.sleep(mdelay)<EOL>mdelay *= backoff<EOL>rv = f(*args, **kwargs)  <EOL><DEDENT>print(str(tries) + "<STR_LIT>")<EOL>return False  <EOL><DEDENT>return f_retry<EOL><DEDENT>return deco_retry<EOL>
Retries a function or method until it returns True.