code: def are_debian_packages_installed(packages: List[str]) -> Dict[str, bool]:
      
      assert len(packages) >= 1
      require_executable(DPKG_QUERY)
      args = [
          DPKG_QUERY,
          "-W",  # --show
          # "-f='${Package} ${Status} ${Version}\n'",
          "-f=${Package} ${Status}\n",  # --showformat
      ] + packages
      completed_process = subprocess.run(args,
                                         stdout=subprocess.PIPE,
                                         stderr=subprocess.PIPE,
                                         check=False)
      encoding = sys.getdefaultencoding()
      stdout = completed_process.stdout.decode(encoding)
      stderr = completed_process.stderr.decode(encoding)
      present = OrderedDict()
      for line in stdout.split("\n"):
          if line:  # e.g. "autoconf install ok installed"
              words = line.split()
              assert len(words) >= 2
              package = words[0]
              present[package] = "installed" in words[1:]
      for line in stderr.split("\n"):
          if line:  # e.g. "dpkg-query: no packages found matching XXX"
              words = line.split()
              assert len(words) >= 2
              package = words[-1]
              present[package] = False
      log.debug("Debian package presence: {}", present)
      return present
docs: Check which of a list of Debian packages are installed, via ``dpkg-query``.
  
      Args:
          packages: list of Debian package names
  
      Returns:
          dict: mapping from package name to boolean ("present?")