docs: def _do_resolve_index(
      python_bin: str,
      solver: PythonSolver,
      *,
      all_solvers: typing.List[PythonSolver],
      requirements: typing.List[str],
      exclude_packages: set = None,
      transitive: bool = True,
      subgraph_check_api: str = None,
  ) -> dict:
      """Perform resolution of requirements against the given solver."""
      index_url = solver.release_fetcher.index_url
      source = solver.release_fetcher.source
  
      packages_seen = set()
      packages = []
      errors = []
      unresolved = []
      unparsed = []
      exclude_packages = exclude_packages or {}
      queue = deque()
  
      for requirement in requirements:
          _LOGGER.debug("Parsing requirement %r", requirement)
          try:
              dependency = PythonDependencyParser.parse_python(requirement)
          except Exception as exc:
              unparsed.append({"requirement": requirement, "details": str(exc)})
              continue
  
          if dependency.name in exclude_packages:
              continue
  
          version_spec = _get_dependency_specification(dependency.spec)
          resolved_versions = _resolve_versions(solver, source, dependency.name, version_spec)
          if not resolved_versions:
              _LOGGER.warning("No versions were resolved for dependency %r in version %r", dependency.name, version_spec)
              unresolved.append({"package_name": dependency.name, "version_spec": version_spec, "index": index_url})
          else:
              for version in resolved_versions:
                  entry = (dependency.name, version)
                  packages_seen.add(entry)
                  queue.append(entry)
  
      while queue:
          package_name, package_version = queue.pop()
          _LOGGER.info("Using index %r to discover package %r in version %r", index_url, package_name, package_version)
          try:
              with _install_requirement(python_bin, package_name, package_version, index_url):
                  package_info = _pipdeptree(python_bin, package_name, warn=True)
          except CommandError as exc:
              _LOGGER.debug(
                  "There was an error during package %r in version %r discovery from %r: %s",
                  package_name,
                  package_version,
                  index_url,
                  exc,
              )
              errors.append(
                  {
                      "package_name": package_name,
                      "index": index_url,
                      "version": package_version,
                      "type": "command_error",
                      "details": exc.to_dict(),
                  }
              )
              continue
  
          if package_info is None:
              errors.append(
                  {
                      "package_name": package_name,
                      "index": index_url,
                      "version": package_version,
                      "type": "not_site_package",
                      "details": {
                          "message": "Failed to get information about installed package, probably not site package"
                      },
                  }
              )
              continue
  
          if package_info["package"]["installed_version"] != package_version:
              _LOGGER.warning(
                  "Requested to install version %r of package %r, but installed version is %r, error is not fatal",
                  package_version,
                  package_name,
                  package_info["package"]["installed_version"],
              )
  
          if package_info["package"]["package_name"] != package_name:
              _LOGGER.warning(
                  "Requested to install package %r, but installed package name is %r, error is not fatal",
                  package_name,
                  package_info["package"]["package_name"],
              )
  
          entry = _create_entry(package_info, source)
          packages.append(entry)
  
          for dependency in entry["dependencies"]:
              dependency_name, dependency_range = dependency["package_name"], dependency["required_version"]
              dependency["resolved_versions"] = []
  
              for dep_solver in all_solvers:
                  _LOGGER.info(
                      "Resolving dependency versions for %r with range %r from %r",
                      dependency_name,
                      dependency_range,
                      dep_solver.release_fetcher.index_url,
                  )
                  resolved_versions = _resolve_versions(
                      dep_solver, dep_solver.release_fetcher.source, dependency_name, dependency_range
                  )
                  _LOGGER.debug(
                      "Resolved versions for package %r with range specifier %r: %s",
                      dependency_name,
                      dependency_range,
                      resolved_versions,
                  )
                  dependency["resolved_versions"].append(
                      {"versions": resolved_versions, "index": dep_solver.release_fetcher.index_url}
                  )
  
                  if not transitive:
                      continue
  
                  for version in resolved_versions:
                      # Did we check this package already - do not check indexes, we manually insert them.
                      seen_entry = (dependency_name, version)
                      if seen_entry not in packages_seen and (
                          not subgraph_check_api
                          or (
                              subgraph_check_api
                              and _should_resolve_subgraph(subgraph_check_api, dependency_name, version, index_url)
                          )
                      ):
                          _LOGGER.debug(
                              "Adding package %r in version %r for next resolution round", dependency_name, version
                          )
                          packages_seen.add(seen_entry)
                          queue.append((dependency_name, version))
  
      return {"tree": packages, "errors": errors, "unparsed": unparsed, "unresolved": unresolved}