code: def wrap_forward_method(self):
      tp = type(self)
      old_forward_method = None
      if hasattr(tp, "forward_for_export"):
          forward_method = tp.forward_for_export
          old_forward_method = tp.forward
          tp.forward = forward_method
      else:
          forward_method = None
      return forward_method, old_forward_method
  
imports: import os
  from contextlib import nullcontext
  from enum import Enum
  from typing import Callable, Dict, Optional, Type
  import onnx
  import torch
  import torch.nn
  import torch.nn.functional
  from nemo.utils import CastToFloat, CastToFloatAll, logging
label_desc: Use image node_id 4 for calling a global function with example usage: wrap_forward_method() and returns: forward_method,  old_forward_method