code: def _find_library(
      library_name: str, priority_dir: Union[str, None] = None
  ) -> Union[str, None]:
      """
      Find the absolute path of the given library name. This function will search in the
      priority directory first, and if the library is not found, it will search the root
      directory. If the library is not found, the function will return None. If there
      are multiple paths available, return only one of the paths.
      :param library_name: The name of library to be found.
      :param priority_dir: A string indicating the absolute path of the directory that
          will be searched first. default: None.
      :return: the string of the absolute path of the library or None if the library is not found.
      """
  
      res = []
      if priority_dir is not None:
          try:
              res = subprocess.check_output(
                  "find " + priority_dir + " -name " + library_name,
                  shell=True,
                  stderr=subprocess.DEVNULL,
              ).splitlines()
          except Exception:
              warnings.warn(
                  "Some errors occurred while trying to find "
                  + library_name
              )
          if len(res) > 0:
              return res[0].decode("utf-8")
  
      try:
          res = subprocess.check_output(
              "find / -name " + library_name,
              shell=True,
              stderr=subprocess.DEVNULL,
          ).splitlines()
      except Exception:
          warnings.warn(
              "Some errors occurred while trying to find "
              + library_name
          )
      return res[0].decode("utf-8") if len(res) > 0 else None
  
file_path: BigDL/python/nano/src/bigdl/nano/utils/common/env.py
imports: import os
  import subprocess
  import warnings
  from typing import Union, Dict, Optional
label_desc: Use image node_id 2 for calling a global function with example usage: _find_library(library_name, priority_dir) and returns: unknown, res