human
I wrote the below code

    def scenario_run_with_retries(scenario_run, *args, **kwargs):
        for attempt in range(1, (max_attempts + 1)):
            if (not scenario_run(*args, **kwargs)):
                if (attempt > 1):
                    message = u'AUTO-RETRY    SCENARIO    PASSED    (after    {0}    attempts)'
                    print(message.format(attempt))
                return False
            if (attempt < max_attempts):
                print(u'AUTO-RETRY    SCENARIO    (attempt    {0})'.format(attempt))
        message = u'AUTO-RETRY    SCENARIO    FAILED    (after    {0}    attempts)'
        print(message.format(max_attempts))
        return True
    if isinstance(scenario, ScenarioOutline):
        scenario_outline = scenario
        for scenario in scenario_outline.scenarios:
            scenario_run = scenario.run
            scenario.run = functools.partial(scenario_run_with_retries, scenario_run)
    else:
        scenario_run = scenario.run
        scenario.run = functools.partial(scenario_run_with_retries, scenario_run)

What's a good function header?
assistant
#Here's a good function header.

def patch_scenario_with_autoretry(scenario, max_attempts=3):