code: def _monitor_thread_function(main_process_pid):
      while True:
          logger.debug(
              "Monitor thread monitoring pid: %d", main_process_pid
          )
          main_process_alive = pid_exists(main_process_pid)
          if not main_process_alive:
              logger.debug(
                  "Main process with pid %d is dead. Killing worker",
                  main_process_pid,
              )
              os._exit(0)
          sleep(1)
  
imports: import logging
  import pickle
  import sys
  import os
  from time import sleep, time
  from traceback import format_exc
  from threading import Thread
  from psutil import pid_exists
  import zmq
  from zmq import ZMQBaseError
  from petastorm.reader_impl.pickle_serializer import PickleSerializer
  from petastorm.workers_pool import EmptyResultError, VentilatedItemProcessedMessage
  from petastorm.workers_pool.exec_in_new_process import exec_in_new_process
label_desc: Use image node_id 3 for calling a global function with example usage: _monitor_thread_function(main_process_pid) without return types