code: def _get_hexagon_rpc_lib_dir() -> pathlib.Path:
      """Find the Hexagon API binaries.
  
      Returns
      -------
      pathlib.Path :
          The path to the Hexagon API directory.
      """
      global HEXAGON_RPC_LIB_DIR
      if HEXAGON_RPC_LIB_DIR is None:
          for path in libinfo.find_lib_path():
              rpc_dir = os.path.join(
                  os.path.dirname(path), "hexagon_api_output"
              )
              if os.path.isdir(rpc_dir):
                  HEXAGON_RPC_LIB_DIR = rpc_dir
                  break
          else:
              raise RuntimeError(
                  "hexagon_api binaries not found, please define HEXAGON_RPC_LIB_DIR"
              )
      return pathlib.Path(HEXAGON_RPC_LIB_DIR)
  
imports: import abc
  import datetime
  import logging
  import multiprocessing
  import os
  import pathlib
  import signal
  import socket
  import stat
  import random
  import string
  import subprocess
  import sys
  import tempfile
  from typing import Union
  from tvm.contrib.hexagon.hexagon_profiler import HexagonProfiler
  from ..._ffi import libinfo
  from .session import Session
  from .tools import HEXAGON_SIMULATOR_NAME
label_desc: Use image node_id 2 for calling a global function with example usage: _get_hexagon_rpc_lib_dir() and returns: pathlib