code: def spawn(fn):
      def wrapped_fn(*args, **kwargs):
          ctx = multiprocessing.get_context("spawn")
          queue = ctx.Queue()
  
          p = ctx.Process(
              target=_subproc_wrapper,
              args=(cloudpickle.dumps(fn), queue, *args),
              kwargs=kwargs,
          )
  
          p.start()
          p.join()
          results = queue.get()
          if isinstance(results, Exception):
              raise RuntimeError(
                  f"Spawned subprocess raised {type(results).__name__}, "
                  f"check log output above for stack trace."
              )
          return results
  
      return wrapped_fn
  
imports: import contextlib
  import multiprocessing
  import os
  import shutil
  import sys
  import tempfile
  import time
  import traceback
  import cloudpickle
  import mock
  from horovod.runner.util.threads import in_thread
label_desc: Use image node_id 14 for calling a global function with example usage: spawn(fn) and returns: wrapped_fn, results