code: def _execute_in_subprocess(
      command_to_exec: CommandType, celery_task_id: str | None = None
  ) -> None:
      env = os.environ.copy()
      if celery_task_id:
          env["external_executor_id"] = celery_task_id
      try:
          subprocess.check_output(
              command_to_exec,
              stderr=subprocess.STDOUT,
              close_fds=True,
              env=env,
          )
      except subprocess.CalledProcessError as e:
          log.exception(
              "[%s] execute_command encountered a CalledProcessError",
              celery_task_id,
          )
          log.error(e.output)
          msg = f"Celery command failed on host: {get_hostname()} with celery_task_id {celery_task_id}"
          raise AirflowException(msg)
  
imports: from __future__ import annotations
  import contextlib
  import logging
  import math
  import os
  import subprocess
  import traceback
  import warnings
  from concurrent.futures import ProcessPoolExecutor
  from typing import TYPE_CHECKING, Any, Mapping, MutableMapping, Optional, Tuple
  from celery import Celery, Task, states
  from celery.backends.base import BaseKeyValueStoreBackend
  from celery.backends.database import DatabaseBackend, Task, retry, session_cleanup
  from celery.signals import import_modules
  from setproctitle import setproctitle
  from sqlalchemy import select
  import airflow.settings
  from airflow.configuration import conf
  from airflow.exceptions import AirflowException, RemovedInAirflow3Warning
  from airflow.executors.base_executor import BaseExecutor
  from airflow.stats import Stats
  from airflow.utils.dag_parsing_context import _airflow_parsing_context_manager
  from airflow.utils.log.logging_mixin import LoggingMixin
  from airflow.utils.net import get_hostname
  from airflow.utils.providers_configuration_loader import providers_configuration_loaded
  from airflow.utils.timeout import timeout
label_desc: Use image node_id 5 for calling a global function with example usage: _execute_in_subprocess(command_to_exec, celery_task_id) without return types