code: def black_mode(is_pyi: bool = Mode.is_pyi) -> Mode:
      config = parse_pyproject_toml(
          os.fspath(AIRFLOW_BREEZE_SOURCES_PATH / "pyproject.toml")
      )
      target_versions = {
          TargetVersion[val.upper()]
          for val in config.get("target_version", ())
      }
  
      return Mode(
          target_versions=target_versions,
          line_length=config.get("line_length", Mode.line_length),
          is_pyi=is_pyi,
      )
  
file_path: airflow/scripts/ci/pre_commit/common_precommit_black_utils.py
imports: from __future__ import annotations
  import os
  import sys
  from functools import lru_cache
  from pathlib import Path
  from black import Mode, TargetVersion, format_str, parse_pyproject_toml
  from common_precommit_utils import AIRFLOW_BREEZE_SOURCES_PATH
label_desc: Use image node_id 1 for calling a global function with example usage: black_mode(is_pyi) and returns: Mode