def repeat_call(func, retries, *args, **kwargs):
retries = max(<NUM_LIT:0>, int(retries))<EOL>try_num = <NUM_LIT:0><EOL>while True:<EOL><INDENT>if try_num == retries:<EOL><INDENT>return func(*args, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>return func(*args, **kwargs)<EOL><DEDENT>except Exception as e:<EOL><INDENT>if isinstance(e, KeyboardInterrupt):<EOL><INDENT>raise e<EOL><DEDENT>try_num += <NUM_LIT:1><EOL><DEDENT><DEDENT><DEDENT>
Tries a total of 'retries' times to execute callable before failing.