code: def assert_pre_commit_installed():
      """
      Check if pre-commit is installed in the right version.
  
      :return: True is the pre-commit is installed in the right version.
      """
      # Local import to make autocomplete work
      import yaml
      from packaging.version import Version
  
      pre_commit_config = yaml.safe_load(
          (AIRFLOW_SOURCES_ROOT / ".pre-commit-config.yaml").read_text()
      )
      min_pre_commit_version = pre_commit_config[
          "minimum_pre_commit_version"
      ]
  
      python_executable = sys.executable
      get_console().print(
          f"[info]Checking pre-commit installed for {python_executable}[/]"
      )
      command_result = run_command(
          [python_executable, "-m", "pre_commit", "--version"],
          capture_output=True,
          text=True,
          check=False,
      )
      if command_result.returncode == 0:
          if command_result.stdout:
              pre_commit_version = command_result.stdout.split(" ")[
                  -1
              ].strip()
              if Version(pre_commit_version) >= Version(
                  min_pre_commit_version
              ):
                  get_console().print(
                      f"\n[success]Package pre_commit is installed. "
                      f"Good version {pre_commit_version} (>= {min_pre_commit_version})[/]\n"
                  )
              else:
                  get_console().print(
                      f"\n[error]Package name pre_commit version is wrong. It should be"
                      f"aat least {min_pre_commit_version} and is {pre_commit_version}.[/]\n\n"
                  )
                  sys.exit(1)
          else:
              get_console().print(
                  "\n[warning]Could not determine version of pre-commit. You might need to update it![/]\n"
              )
      else:
          get_console().print(
              "\n[error]Error checking for pre-commit-installation:[/]\n"
          )
          get_console().print(command_result.stderr)
          get_console().print(
              "\nMake sure to run:\n      breeze setup self-upgrade\n\n"
          )
          sys.exit(1)
  
imports: from __future__ import annotations
  import atexit
  import contextlib
  import os
  import re
  import shlex
  import shutil
  import signal
  import stat
  import subprocess
  import sys
  from functools import lru_cache
  from pathlib import Path
  from typing import Mapping, Union
  from rich.markup import escape
  from airflow_breeze.utils.ci_group import ci_group
  from airflow_breeze.utils.console import Output, get_console
  from airflow_breeze.utils.path_utils import AIRFLOW_SOURCES_ROOT, WWW_ASSET_COMPILE_LOCK, WWW_ASSET_HASH_FILE, WWW_ASSET_OUT_DEV_MODE_FILE, WWW_ASSET_OUT_FILE, WWW_NODE_MODULES_DIR, WWW_STATIC_DIST_DIR
  from airflow_breeze.utils.shared_options import get_dry_run, get_verbose
label_desc: Use image node_id 3 for calling a global function with example usage: assert_pre_commit_installed() without return types