code: def _run_code(
      code,
      run_globals,
      init_globals=None,
      mod_name=None,
      mod_spec=None,
      pkg_name=None,
      script_name=None,
  ):
      """Helper to run code in nominated namespace"""
      if init_globals is not None:
          run_globals.update(init_globals)
      if mod_spec is None:
          loader = None
          fname = script_name
          cached = None
      else:
          loader = mod_spec.loader
          fname = mod_spec.origin
          cached = mod_spec.cached
          if pkg_name is None:
              pkg_name = mod_spec.parent
      run_globals.update(
          __name__=mod_name,
          __file__=fname,
          __cached__=cached,
          __doc__=None,
          __loader__=loader,
          __package__=pkg_name,
          __spec__=mod_spec,
      )
      exec(code, run_globals)
      return run_globals
  
imports: import sys
  import importlib.machinery
  import importlib.util
  import io
  import os
label_desc: Use image node_id 1 for calling a global function with example usage: _run_code(code, run_globals, init_globals, mod_name, mod_spec, pkg_name, script_name) and returns: run_globals