code: def start_nanny(**kwargs):
      """Start a nanny subprocess
  
      Returns
      -------
  
      nanny_url: str
        The proxied URL the engine's control socket should connect to,
        instead of connecting directly to the control Scheduler.
      """
  
      kwargs["pid"] = os.getpid()
  
      env = os.environ.copy()
      env["PYTHONUNBUFFERED"] = "1"
      p = Popen(
          [sys.executable, "-m", __name__],
          stdin=PIPE,
          stdout=PIPE,
          env=env,
          start_new_session=True,  # don't inherit signals
      )
      p.stdin.write(pickle.dumps(kwargs))
      p.stdin.close()
      out = p.stdout.readline()
      nanny_url = out.decode("utf8").strip()
      if not nanny_url:
          p.terminate()
          raise RuntimeError("nanny failed")
      # return the handle on the process
      # need to keep the pipe open for the nanny
      return nanny_url, p
  
imports: import asyncio
  import logging
  import os
  import pickle
  import signal
  import sys
  from subprocess import PIPE, Popen
  from threading import Thread
  import psutil
  import zmq
  from jupyter_client.session import Session
  from tornado.ioloop import IOLoop
  from traitlets.config import Config
  from zmq.eventloop.zmqstream import ZMQStream
  from ipyparallel import error, util
  from ipyparallel.util import local_logger
label_desc: Use image node_id 1 for calling a global function with example usage: start_nanny() and returns: nanny_url,  p