code: def _run_compile_internally(
      command_to_execute: list[str], dev: bool
  ) -> RunCommandResult:
      from filelock import SoftFileLock, Timeout
  
      env = os.environ.copy()
      if dev:
          return run_command(
              command_to_execute,
              check=False,
              no_output_dump_on_exception=True,
              text=True,
              env=env,
          )
      else:
          WWW_ASSET_COMPILE_LOCK.parent.mkdir(
              parents=True, exist_ok=True
          )
          WWW_ASSET_COMPILE_LOCK.unlink(missing_ok=True)
          try:
              with SoftFileLock(WWW_ASSET_COMPILE_LOCK, timeout=5):
                  with open(WWW_ASSET_OUT_FILE, "w") as output_file:
                      result = run_command(
                          command_to_execute,
                          check=False,
                          no_output_dump_on_exception=True,
                          text=True,
                          env=env,
                          stderr=subprocess.STDOUT,
                          stdout=output_file,
                      )
                  if result.returncode == 0:
                      WWW_ASSET_OUT_FILE.unlink(missing_ok=True)
                  return result
          except Timeout:
              get_console().print(
                  "[error]Another asset compilation is running. Exiting[/]\n"
              )
              get_console().print(
                  "[warning]If you are sure there is no other compilation,[/]"
              )
              get_console().print(
                  "[warning]Remove the lock file and re-run compilation:[/]"
              )
              get_console().print(WWW_ASSET_COMPILE_LOCK)
              get_console().print()
              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 14 for calling a global function with example usage: _run_compile_internally(command_to_execute, dev) and returns: run_command, result