docs: def which(name, flags=os.X_OK):
      """
      Search PATH for executable files with the given name.
  
      Taken from Twisted.
      """
      result = []
      exts = filter(None, os.environ.get('PATHEXT', '').split(os.pathsep))
      path = os.environ.get('PATH', None)
      if path is None:
          return []
      for p in os.environ.get('PATH', '').split(os.pathsep):
          p = os.path.join(p, name)
          if os.access(p, flags):
              result.append(p)
          for e in exts:
              pext = p + e
              if os.access(pext, flags):
                  result.append(pext)
      return result