code: def have(cmd):
      
  
      try:
          # Python 3.3+ only
          from shutil import which
      except ImportError:
          def which(cmd):
              """
              Given a command, return the path which conforms to the given mode
              on the PATH, or None if there is no such file.
              """
  
              def _access_check(path):
                  """
                  Check that a given file can be accessed with the correct mode.
                  Additionally check that `path` is not a directory.
                  """
                  return (os.path.exists(path) and os.access(
                      path, os.F_OK | os.X_OK) and not os.path.isdir(path))
  
              # If we're given a path with a directory part, look it up directly
              # rather than referring to PATH directories. This includes checking
              # relative to the current directory, e.g. ./script
              if os.path.dirname(cmd):
                  if _access_check(cmd):
                      return cmd
                  return None
  
              paths = os.environ.get('PATH', os.defpath.lstrip(':')).split(':')
  
              seen = set()
              for path in paths:
                  if path not in seen:
                      seen.add(path)
                      name = os.path.join(path, cmd)
                      if _access_check(name):
                          return name
              return None
  
      return which(cmd) is not None
docs: Determine whether supplied argument is a command on the PATH.