code: def run_onlyif_instance(
      cond_type: Type[Any],
      return_orig: bool = True,
      return_const: Any = None,
  ):
      def helper(fn):
          if return_orig:
  
              @functools.wraps(fn)
              def wrapper_orig(*args):
                  if _orig_isinstance(args[-1], cond_type):
                      return fn(*args)
                  return args[-1]
  
              return wrapper_orig
          else:
  
              @functools.wraps(fn)
              def wrapper_const(*args):
                  if _orig_isinstance(args[-1], cond_type):
                      return fn(*args)
                  return return_const
  
              return wrapper_const
  
      return helper
  
file_path: nni/nni/common/concrete_trace_utils/utils.py
imports: import builtins
  import operator
  from typing import Any, Callable, Type
  import functools
  import torch
  from torch.fx import Node
label_desc: Use image node_id 1 for calling a global function with example usage: run_onlyif_instance(cond_type, return_orig, return_const) and returns: helper, wrapper_orig, wrapper_const, args, return_const, fn, fn