code: def _serving(sock, addr, opts, load_library):
      logger.info(f"connected from {addr}")
      work_path = utils.tempdir()
      old_cwd = os.getcwd()
      os.chdir(
          work_path.path
      )  # Avoiding file name conflict between sessions.
      logger.info(f"start serving at {work_path.path}")
  
      server_proc = multiprocessing.Process(
          target=_serve_loop, args=(sock, load_library, work_path)
      )
      server_proc.start()
      server_proc.join(
          opts.get("timeout", None)
      )  # Wait until finish or timeout.
  
      if server_proc.is_alive():
          logger.info("timeout in RPC session, kill..")
          _ffi_api.ReturnException(
              sock.fileno(),
              f'RPCSessionTimeoutError: Your {opts["timeout"]}s session has expired, '
              f'try to increase the "session_timeout" value.',
          )
  
          try:
              import psutil  # pylint: disable=import-outside-toplevel
  
              # Terminate worker children firstly.
              for child in psutil.Process(server_proc.pid).children(
                  recursive=True
              ):
                  child.terminate()
          except ImportError:
              # Don't dependent `psutil` hardly, because it isn't a pure Python
              # package and maybe hard to be installed on some platforms.
              pass
          server_proc.terminate()
  
      logger.info(f"finish serving {addr}")
      os.chdir(old_cwd)
      work_path.remove()
      sock.close()
  
imports: import os
  import ctypes
  import socket
  import select
  import struct
  import logging
  import threading
  import multiprocessing
  import time
  import errno
  import tvm._ffi
  from tvm._ffi.base import py_str
  from tvm._ffi.libinfo import find_lib_path
  from tvm.runtime.module import load_module
  from tvm.contrib import utils
  from tvm.contrib.popen_pool import PopenWorker
  from .None import _ffi_api
  from .None import base
  from .None import testing
  from .base import TrackerCode
label_desc: Use image node_id 4 for calling a global function with example usage: _serving(sock, addr, opts, load_library) without return types