code: def map_recursive(fn: Callable, arg) -> Any:
      """
      Apply fn to each Node appearing arg. arg may be a list, tuple, slice, or dict with string keys.
      """
      if _orig_type(arg) != torch.Size and _orig_isinstance(
          arg, _orig_tuple
      ):
          t = _orig_tuple(map_recursive(fn, elem) for elem in arg)
          # Support NamedTuple (if it has `_fields`) by repacking into original type.
          return (
              t if not hasattr(arg, "_fields") else _orig_type(arg)(*t)
          )
      elif _orig_isinstance(arg, _orig_list):
          return _orig_list(map_recursive(fn, elem) for elem in arg)
      elif _orig_isinstance(arg, _orig_dict):
          return {k: map_recursive(fn, v) for k, v in arg.items()}
      else:
          return fn(arg)
  
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 2 for calling a global function with example usage: map_recursive(fn, arg) and returns: unknown, _orig_list, unknown, fn