code: def addsitedir(sitedir, known_paths=None):
      """Add 'sitedir' argument to sys.path if missing and handle .pth files in
      'sitedir'"""
      _trace(f"Adding directory: {sitedir!r}")
      if known_paths is None:
          known_paths = _init_pathinfo()
          reset = True
      else:
          reset = False
      sitedir, sitedircase = makepath(sitedir)
      if not sitedircase in known_paths:
          sys.path.append(sitedir)  # Add path component
          known_paths.add(sitedircase)
      try:
          names = os.listdir(sitedir)
      except OSError:
          return
      names = [name for name in names if name.endswith(".pth")]
      for name in sorted(names):
          addpackage(sitedir, name, known_paths)
      if reset:
          known_paths = None
      return known_paths
  
imports: import sys
  import os
  import builtins
  import _sitebuiltins
  import io
label_desc: Use image node_id 7 for calling a global function with example usage: addsitedir(sitedir, known_paths) and returns: known_paths