def retry(retries=<NUM_LIT:10>, wait=<NUM_LIT:5>, catch=None):
catch = catch or (Exception,)<EOL>def real_retry(function):<EOL><INDENT>def wrapper(*args, **kwargs):<EOL><INDENT>for _ in range(retries):<EOL><INDENT>try:<EOL><INDENT>ret = function(*args, **kwargs)<EOL>return ret<EOL><DEDENT>except catch:<EOL><INDENT>time.sleep(wait)<EOL><DEDENT>except Exception as e:<EOL><INDENT>raise e<EOL><DEDENT>else:<EOL><INDENT>raise DSBException('<STR_LIT>')<EOL><DEDENT><DEDENT><DEDENT>return wrapper<EOL><DEDENT>return real_retry<EOL>
Decorator to retry on exceptions raised