code: def generate_providers_requirements(
      python: str,
      provider_id: str | None,
      provider_version: str | None,
      run_in_parallel: bool,
      parallelism: int,
      debug_resources: bool,
      include_success_outputs: bool,
      skip_cleanup: bool,
      force: bool,
  ):
      perform_environment_checks()
  
      if python is None:
          python_versions = ALL_HISTORICAL_PYTHON_VERSIONS
      else:
          python_versions = [python]
  
      with open(PROVIDER_METADATA_JSON_FILE_PATH) as f:
          provider_metadata = json.load(f)
  
      if provider_id is None:
          if (
              provider_version is not None
              and provider_version != "latest"
          ):
              get_console().print(
                  "[error] You cannot pin the version of the providers if you generate the requirements for "
                  "all historical or latest versions. --provider-version needs to be unset when you pass None "
                  "or latest to --provider-id"
              )
              sys.exit(1)
          provider_ids = provider_metadata.keys()
      else:
          provider_ids = [provider_id]
  
      if provider_version is None:
          user_confirm(
              f"You are about to generate providers requirements for all historical versions for "
              f"{len(provider_ids)} provider(s) based on `provider_metadata.json` file. "
              f"Do you want to proceed?",
              quit_allowed=False,
              default_answer=Answer.YES,
          )
  
      providers_info = []
      for provider_id in provider_ids:
          if provider_version is not None:
              if provider_version == "latest":
                  # Only the latest version for each provider
                  p_version, info = list(
                      provider_metadata[provider_id].items()
                  )[-1]
              else:
                  # Specified providers version
                  info = provider_metadata[provider_id][
                      provider_version
                  ]
                  p_version = provider_version
  
              airflow_version = info["associated_airflow_version"]
  
              providers_info += [
                  (
                      provider_id,
                      p_version,
                      python_version,
                      airflow_version,
                  )
                  for python_version in AIRFLOW_PYTHON_COMPATIBILITY_MATRIX[
                      airflow_version
                  ]
                  if python_version in python_versions
              ]
          else:
              # All historical providers' versions
              providers_info += [
                  (
                      provider_id,
                      p_version,
                      python_version,
                      info["associated_airflow_version"],
                  )
                  for (p_version, info) in provider_metadata[
                      provider_id
                  ].items()
                  for python_version in AIRFLOW_PYTHON_COMPATIBILITY_MATRIX[
                      info["associated_airflow_version"]
                  ]
                  if python_version in python_versions
              ]
  
      if run_in_parallel:
          parallelism = min(parallelism, len(providers_info))
          get_console().print(
              f"[info]Running {len(providers_info)} jobs in parallel"
          )
          with ci_group(
              f"Generating provider requirements for {providers_info}"
          ):
              all_params = [
                  f"Generate provider requirements for {provider_id} version {provider_version} python "
                  f"{python_version}"
                  for (
                      provider_id,
                      provider_version,
                      python_version,
                      _,
                  ) in providers_info
              ]
              with run_with_pool(
                  parallelism=parallelism,
                  all_params=all_params,
                  debug_resources=debug_resources,
                  progress_matcher=ShowLastLineProgressMatcher(),
              ) as (pool, outputs):
                  results = [
                      pool.apply_async(
                          get_requirements_for_provider,
                          kwds={
                              "provider_id": provider_id,
                              "airflow_version": airflow_version,
                              "provider_version": provider_version,
                              "python_version": python_version,
                              "force": force,
                              "output": outputs[index],
                          },
                      )
                      for (
                          index,
                          (
                              provider_id,
                              provider_version,
                              python_version,
                              airflow_version,
                          ),
                      ) in enumerate(providers_info)
                  ]
          check_async_run_results(
              results=results,
              success="Providers requirements were generated successfully",
              outputs=outputs,
              include_success_outputs=include_success_outputs,
              skip_cleanup=skip_cleanup,
          )
      else:
          for (
              provider_id,
              provider_version,
              python_version,
              airflow_version,
          ) in providers_info:
              get_requirements_for_provider(
                  provider_id=provider_id,
                  provider_version=provider_version,
                  airflow_version=airflow_version,
                  python_version=python_version,
                  force=force,
                  output=None,
              )
  
imports: from __future__ import annotations
  import json
  import os
  import sys
  from pathlib import Path
  import click
  from airflow_breeze.commands.common_options import option_answer, option_debug_resources, option_dry_run, option_historical_python_version, option_include_success_outputs, option_parallelism, option_run_in_parallel, option_skip_cleanup, option_verbose
  from airflow_breeze.global_constants import AIRFLOW_PYTHON_COMPATIBILITY_MATRIX, ALL_HISTORICAL_PYTHON_VERSIONS, PROVIDER_DEPENDENCIES
  from airflow_breeze.utils.cdxgen import PROVIDER_REQUIREMENTS_DIR_PATH, SbomApplicationJob, SbomCoreJob, SbomProviderJob, build_all_airflow_versions_base_image, get_cdxgen_port_mapping, get_requirements_for_provider, list_providers_from_providers_requirements
  from airflow_breeze.utils.ci_group import ci_group
  from airflow_breeze.utils.click_utils import BreezeGroup
  from airflow_breeze.utils.confirm import Answer, user_confirm
  from airflow_breeze.utils.console import get_console
  from airflow_breeze.utils.custom_param_types import BetterChoice
  from airflow_breeze.utils.docker_command_utils import perform_environment_checks
  from airflow_breeze.utils.parallel import DockerBuildxProgressMatcher, ShowLastLineProgressMatcher, check_async_run_results, run_with_pool
  from airflow_breeze.utils.path_utils import FILES_SBOM_DIR, PROVIDER_METADATA_JSON_FILE_PATH
  from airflow_breeze.utils.shared_options import get_dry_run
label_desc: Use image node_id 4 for calling a global function with example usage: generate_providers_requirements(python, provider_id, provider_version, run_in_parallel, parallelism, debug_resources, include_success_outputs, skip_cleanup, force) without return types