docs: def _windows_resolve(command):
      """
      Try and find the full path and file extension of the executable to run.
      This is so that e.g. calls to 'somescript' will point at 'somescript.cmd'
      without the need to set shell=True in the subprocess.
      If the executable contains periods it is a special case. Here the
      win32api call will fail to resolve the extension automatically, and it
      has do be done explicitly.
  
      :param command: The command array to be run, with the first element being
                      the command with or w/o path, with or w/o extension.
      :return: Returns the command array with the executable resolved with the
               correct extension. If the executable cannot be resolved for any
               reason the original command array is returned.
      """
      try:
          import win32api
      except ImportError:
          if (2, 8) < sys.version_info < (3, 5):
              logger.info(
                  "Resolving executable names only supported on Python 2.7 and 3.5+"
              )
          else:
              logger.warning(
                  "Could not resolve executable name: package win32api missing"
              )
          return command
  
      if not command or not isinstance(command[0], six.string_types):
          return command
  
      try:
          _, found_executable = win32api.FindExecutable(command[0])
          logger.debug("Resolved %s as %s", command[0], found_executable)
          return (found_executable,) + tuple(command[1:])
      except Exception as e:
          if not hasattr(e, "winerror"):
              raise
          # Keep this error message for later in case we fail to resolve the name
          logwarning = getattr(e, "strerror", str(e))
  
      if "." in command[0]:
          # Special case. The win32api may not properly check file extensions, so
          # try to resolve the executable explicitly.
          for extension in os.getenv("PATHEXT").split(os.pathsep):
              try:
                  _, found_executable = win32api.FindExecutable(command[0] + extension)
                  logger.debug("Resolved %s as %s", command[0], found_executable)
                  return (found_executable,) + tuple(command[1:])
              except Exception as e:
                  if not hasattr(e, "winerror"):
                      raise
  
      logger.warning("Error trying to resolve the executable: %s", logwarning)
      return command