code: def run_sp(func, *args, **kwargs):
      """
      Run a function in a subprocess and return its value.  This is for achieving subprocess
      isolation, not parallelism.  The subprocess is configured so things like logging work
      correctly, and is initialized with a derived random seed.
      """
      ctx = LKContext.INSTANCE
      rq = ctx.SimpleQueue()
      seed = seedbank.derive_seed()
      worker_args = (log_queue(), seed, rq, func, args, kwargs)
      _log.debug("spawning subprocess to run %s", func)
      proc = ctx.Process(target=_sp_worker, args=worker_args)
      proc.start()
      _log.debug("waiting for process %s to return", proc)
      success, payload = rq.get()
      _log.debug("received success=%s", success)
      _log.debug("waiting for process %s to exit", proc)
      proc.join()
      if proc.exitcode:
          _log.error("subprocess failed with code %d", proc.exitcode)
          raise RuntimeError(
              "subprocess failed with code " + str(proc.exitcode)
          )
      if success:
          return payload
      else:
          _log.error("subprocess raised exception: %s", payload)
          raise ChildProcessError("error in child process", payload)
  
imports: import os
  import multiprocessing
  from multiprocessing.queues import SimpleQueue
  import functools
  import logging
  import logging.handlers
  import faulthandler
  from concurrent.futures import ProcessPoolExecutor
  from abc import ABC, abstractmethod
  import pickle
  from threadpoolctl import threadpool_limits
  import seedbank
  from lenskit.sharing import persist, PersistedModel
  from lenskit.util.log import log_queue
label_desc: Use image node_id 10 for calling a global function with example usage: run_sp(func) and returns: payload