code: def process_loop(
      conn: Connection,
      user_init: Callable[[], None],
      loglevel,
      task,
      task_args,
  ):
      """Initialize a process pool worker."""
      # Install SIGBUS handler (so our parent process can abort somewhat gracefully)
      with suppress(
          AttributeError
      ):  # Windows and Cygwin do not have SIGBUS
          # Windows and Cygwin do not have pthread_sigmask or SIGBUS
          signal.signal(signal.SIGBUS, process_sigbus)
  
      # Reconfigure the root logger for this process to send all messages to a queue
      h = ConnectionLogHandler(conn)
      root = logging.getLogger()
      remove_all_log_handlers(root)
      root.setLevel(loglevel)
      root.addHandler(h)
  
      user_init()
  
      for args in task_args:
          try:
              result = task(*args)
          except Exception as e:  # pylint: disable=broad-except
              conn.send((MessageType.exception, e))
              break
          else:
              conn.send((MessageType.result, result))
  
      conn.send((MessageType.complete, None))
      conn.close()
      return
  
imports: from __future__ import annotations
  import logging
  import logging.handlers
  import signal
  from collections.abc import Iterable, Iterator
  from contextlib import suppress
  from enum import Enum, auto
  from itertools import islice, repeat, takewhile, zip_longest
  from multiprocessing import Pipe, Process
  from multiprocessing.connection import Connection, wait
  from typing import Callable
  from ocrmypdf import Executor, hookimpl
  from ocrmypdf._concurrent import NullProgressBar
  from ocrmypdf.exceptions import InputFileError
  from ocrmypdf.helpers import remove_all_log_handlers
label_desc: Use image node_id 3 for calling a global function with example usage: process_loop(conn, user_init, loglevel, task, task_args) without return types