code: def get_python_path(environ_cp, python_bin_path):
      """Get the python site package paths."""
      python_paths = []
      if environ_cp.get("PYTHONPATH"):
          python_paths = environ_cp.get("PYTHONPATH").split(":")
      try:
          stderr = open(os.devnull, "wb")
          library_paths = run_shell(
              [
                  python_bin_path,
                  "-c",
                  'import site; print("\\n".join(site.getsitepackages()))',
              ],
              stderr=stderr,
          ).split("\n")
      except subprocess.CalledProcessError:
          library_paths = [
              run_shell(
                  [
                      python_bin_path,
                      "-c",
                      "from distutils.sysconfig import get_python_lib;"
                      "print(get_python_lib())",
                  ]
              )
          ]
  
      all_paths = set(python_paths + library_paths)
      # Sort set so order is deterministic
      all_paths = sorted(all_paths)
  
      paths = []
      for path in all_paths:
          if os.path.isdir(path):
              paths.append(path)
      return paths
  
imports: import os
  import platform
  import re
  import subprocess
  import sys
label_desc: Use image node_id 14 for calling a global function with example usage: get_python_path(environ_cp, python_bin_path) and returns: paths