code: def add_site_dir(dir_name, before=None, _path=None):
      
  
      log.log(5, 'add_site_dir(%r, before=%r)', dir_name, before)
      
      # Don't do anything if the folder doesn't exist.
      if not os.path.exists(dir_name):
          return
      
      path = _path or SysPathInserter(index=before)
      path.add(dir_name)
  
      # Process *.pth files in a manner similar to site.addsitedir(...).
      for file_name in os.listdir(dir_name):
      
          # Skip dotfiles.
          if file_name.startswith('.'):
              continue
      
          # *.pth files.
          if file_name.endswith('.pth'):
              _process_pth(path, dir_name, file_name)
      
          # __site__.pth files inside packages.
          if os.path.exists(os.path.join(dir_name, file_name, '__site__.pth')):
              _process_pth(path, os.path.join(dir_name, file_name), '__site__.pth')
docs: Add a pseudo site-packages directory to :data:`python:sys.path`.
      
      :param str dir_name: The directory to add.
      :param str before: A directory on :data:`sys.path` that new paths should be
      inserted before.
      
      Looks for ``.pth`` files at the top-level and ``__site__.pth`` files within
      top-level directories.