def METHOD_NAME(func, *args, **kwargs):
    def ommit_test_in_name(name):
        if name.startswith('test_'):
            return name[5:]
    mitmproxy_url = environ.get('MITMPROXY_HOST', 'http://mitm-manager.local')
    mitm_client = MITMClient(mitmproxy_url)
    final_scenario_name = scenario_name or ommit_test_in_name(func.__name__)
    try:
        mitm_client.set_scenario(final_scenario_name)
        if should_record:
            mitm_client.start_recording()
        func(*args, **kwargs)
    except Exception:
        raise
    finally:
        mitm_client.stop_recording()
        mitm_client.set_scenario('default')