code: def get_airflow_constraints_location(
      airflow_constraints_mode: str,
      airflow_constraints_location: str | None,
      airflow_constraints_reference: str | None,
      default_constraints_branch: str,
      airflow_package_version: str | None,
      github_repository: str,
      python_version: str,
      airflow_skip_constraints: bool,
  ) -> str | None:
      """For Airflow we determine constraints in this order of preference:
      * AIRFLOW_SKIP_CONSTRAINTS=true - no constraints
      * AIRFLOW_CONSTRAINTS_LOCATION -  constraints from this location (url)
      * AIRFLOW_CONSTRAINTS_REFERENCE + constraints mode if specified
      * if we know airflow version "constraints-VERSION" + constraints mode
      * DEFAULT_CONSTRAINT_BRANCH + constraints mode - as fallback
      * constraints-main + constraints mode - as fallback
      """
      if airflow_skip_constraints:
          return None
      if airflow_constraints_location:
          console.print(
              f"[info]Using constraints from location: {airflow_constraints_location}"
          )
          return airflow_constraints_location
      if airflow_constraints_reference:
          console.print(
              f"[info]Building constraints location from "
              f"constraints reference: {airflow_constraints_reference}"
          )
      elif airflow_package_version:
          if re.match(
              r"[0-9]+\.[0-9]+\.[0-9]+[0-9a-z.]*|main|v[0-9]_.*",
              airflow_package_version,
          ):
              airflow_constraints_reference = (
                  f"constraints-{airflow_package_version}"
              )
              console.print(
                  f"[info]Determined constraints reference from airflow package version "
                  f"{airflow_package_version} as: {airflow_constraints_reference}"
              )
          else:
              airflow_constraints_reference = default_constraints_branch
              console.print(
                  f"[info]Falling back tp: {default_constraints_branch}"
              )
      return calculate_constraints_location(
          constraints_mode=airflow_constraints_mode,
          constraints_reference=airflow_constraints_reference,
          github_repository=github_repository,
          python_version=python_version,
          providers=False,
      )
  
file_path: airflow/scripts/in_container/install_airflow_and_providers.py
imports: from __future__ import annotations
  import re
  import sys
  from pathlib import Path
  from typing import NamedTuple
  from in_container_utils import click, console, run_command
label_desc: Use image node_id 6 for calling a global function with example usage: get_airflow_constraints_location(airflow_constraints_mode, airflow_constraints_location, airflow_constraints_reference, default_constraints_branch, airflow_package_version, github_repository, python_version, airflow_skip_constraints) and returns: calculate_constraints_location, None, airflow_constraints_location