code: def get_global_references_from_nested_code(
      code, global_scope, global_refs
  ):
      for constant in code.co_consts:
          if inspect.iscode(constant):
              closure = tuple(
                  types.CellType(None)
                  for _ in range(len(constant.co_freevars))
              )
              dummy_function = types.FunctionType(
                  constant,
                  global_scope,
                  "dummy_function",
                  closure=closure,
              )
              global_refs.update(
                  inspect.getclosurevars(dummy_function).globals
              )
              get_global_references_from_nested_code(
                  constant, global_scope, global_refs
              )
  
file_path: DALI/dali/python/nvidia/dali/reducers.py
imports: import inspect
  import pickle
  import sys
  import types
  import marshal
  import importlib
label_desc: Use image node_id 2 for calling a global function with example usage: get_global_references_from_nested_code(code, global_scope, global_refs) without return types