def METHOD_NAME(opt, closure=None):
    # run the patcher so that step has the expected structure
    torch._dynamo.eval_frame.TorchPatcher.patch()
    # unwrap step to avoid a deliberate graph break due to
    # a limitation of functionalization/no_grad detection
    # see the [Note on graph break] in optimizer.py
    # This ignores the outer _use_grad_if_differentiable wrapper, which is fine for now
    # as dynamo does not support differentiable optimizers anyway
    step_fn = opt.step.__wrapped__
    if closure is not None:
        def fn():
            step_fn(opt, closure)
    else:
        def fn():
            step_fn(opt)
    return fn