code: def dims(lists=0):
      frame = inspect.currentframe()
      assert frame is not None
      calling_frame = frame.f_back
      assert calling_frame is not None
      code, lasti = calling_frame.f_code, calling_frame.f_lasti
      key = (code, lasti)
      if key not in _cache:
          first = lasti // 2 + 1
          instructions = list(
              dis.get_instructions(calling_frame.f_code)
          )
          unpack = instructions[first]
  
          if (
              unpack.opname == "STORE_FAST"
              or unpack.opname == "STORE_NAME"
          ):
              # just a single dim, not a list
              name = unpack.argval
              ctor = Dim if lists == 0 else DimList
              _cache[key] = lambda: ctor(name=name)
          else:
              assert unpack.opname == "UNPACK_SEQUENCE"
              ndims = unpack.argval
              names = tuple(
                  extract_name(instructions[first + 1 + i])
                  for i in range(ndims)
              )
              first_list = len(names) - lists
              _cache[key] = lambda: tuple(
                  Dim(n) if i < first_list else DimList(name=n)
                  for i, n in enumerate(names)
              )
      return _cache[key]()
  
file_path: pytorch/functorch/dim/dim.py
imports: import dis
  import inspect
  from dataclasses import dataclass
  from typing import Union
  from .None import DimList
label_desc: Use image node_id 2 for calling a global function with example usage: dims(lists) and returns: _cache