code: def _run_module_code(
      code,
      init_globals=None,
      mod_name=None,
      mod_spec=None,
      pkg_name=None,
      script_name=None,
  ):
      """Helper to run code in new namespace with sys modified"""
      fname = script_name if mod_spec is None else mod_spec.origin
      with _TempModule(mod_name) as temp_module, _ModifiedArgv0(fname):
          mod_globals = temp_module.module.__dict__
          _run_code(
              code,
              mod_globals,
              init_globals,
              mod_name,
              mod_spec,
              pkg_name,
              script_name,
          )
      # Copy the globals of the temporary module, as they
      # may be cleared when the temporary module goes away
      return mod_globals.copy()
  
imports: import sys
  import importlib.machinery
  import importlib.util
  import io
  import os
label_desc: Use image node_id 2 for calling a global function with example usage: _run_module_code(code, init_globals, mod_name, mod_spec, pkg_name, script_name) and returns: mod_globals