code: def is_virtual_environment(path):
      
      if not path.is_dir():
          return False
      for bindir_name in ('bin', 'Scripts'):
          for python in path.joinpath(bindir_name).glob('python*'):
              try:
                  exeness = python.is_file() and os.access(str(python), os.X_OK)
              except OSError:
                  exeness = False
              if exeness:
                  return True
      return False
docs: Check if a given path is a virtual environment's root.
  
      This is done by checking if the directory contains a Python executable in
      its bin/Scripts directory. Not technically correct, but good enough for
      general usage.