code: def get_preparation_data(name, init_main_module=True):
      """Return info about parent needed by child to unpickle process object."""
      _check_not_importing_main()
      d = dict(
          log_to_stderr=util._log_to_stderr,
          authkey=bytes(process.current_process().authkey),
          name=name,
          sys_argv=sys.argv,
          orig_dir=process.ORIGINAL_DIR,
          dir=os.getcwd(),
      )
  
      # Send sys_path and make sure the current directory will not be changed
      d["sys_path"] = [
          p if p != "" else process.ORIGINAL_DIR for p in sys.path
      ]
  
      # Make sure to pass the information if the multiprocessing logger is active
      if util._logger is not None:
          d["log_level"] = util._logger.getEffectiveLevel()
          if util._logger.handlers:
              h = util._logger.handlers[0]
              d["log_fmt"] = h.formatter._fmt
  
      # Tell the child how to communicate with the resource_tracker
      from .resource_tracker import _resource_tracker
  
      _resource_tracker.ensure_running()
      d["tracker_args"] = {"pid": _resource_tracker._pid}
      if sys.platform == "win32":
          d["tracker_args"]["fh"] = msvcrt.get_osfhandle(
              _resource_tracker._fd
          )
      else:
          d["tracker_args"]["fd"] = _resource_tracker._fd
  
      if sys.version_info >= (3, 8) and os.name == "posix":
          # joblib/loky#242: allow loky processes to retrieve the resource
          # tracker of their parent in case the child processes depickles
          # shared_memory objects, that are still tracked by multiprocessing's
          # resource_tracker by default.
          # XXX: this is a workaround that may be error prone: in the future, it
          # would be better to have loky subclass multiprocessing's shared_memory
          # to force registration of shared_memory segments via loky's
          # resource_tracker.
          from multiprocessing.resource_tracker import (
              _resource_tracker as mp_resource_tracker,
          )
  
          # multiprocessing's resource_tracker must be running before loky
          # process is created (othewise the child won't be able to use it if it
          # is created later on)
          mp_resource_tracker.ensure_running()
          d["mp_tracker_args"] = {
              "fd": mp_resource_tracker._fd,
              "pid": mp_resource_tracker._pid,
          }
  
      # Figure out whether to initialise main in the subprocess as a module
      # or through direct execution (or to leave it alone entirely)
      if init_main_module:
          main_module = sys.modules["__main__"]
          try:
              main_mod_name = getattr(
                  main_module.__spec__, "name", None
              )
          except BaseException:
              main_mod_name = None
          if main_mod_name is not None:
              d["init_main_from_name"] = main_mod_name
          elif sys.platform != "win32" or (
              not WINEXE and not WINSERVICE
          ):
              main_path = getattr(main_module, "__file__", None)
              if main_path is not None:
                  if (
                      not os.path.isabs(main_path)
                      and process.ORIGINAL_DIR is not None
                  ):
                      main_path = os.path.join(
                          process.ORIGINAL_DIR, main_path
                      )
                  d["init_main_from_path"] = os.path.normpath(main_path)
  
      return d
  
file_path: catboost/contrib/python/joblib/joblib/externals/loky/backend/spawn.py
imports: import os
  import sys
  import runpy
  import textwrap
  import types
  from multiprocessing import process, util
label_desc: Use image node_id 3 for calling a global function with example usage: get_preparation_data(name, init_main_module) and returns: d