def METHOD_NAME(*args, **kwds):
    profile = kwds.get("profile", None)
    if profile:
        ctx = args[0]
        profile_defaults = profiles.ensure_profile(ctx, profile, **kwds)
        _setup_profile_options(ctx, profile_defaults, kwds)
    try:
        return f(*args, **kwds)
    except ExitCodeException as e:
        sys.exit(e.exit_code)