code: def _prepare_app(broker_url=None, execute=None):
      broker_url = broker_url or conf.get("celery", "BROKER_URL")
  
      execute = (
          execute or celery_executor_utils.execute_command.__wrapped__
      )
  
      test_config = dict(celery_executor_utils.celery_configuration)
      test_config.update({"broker_url": broker_url})
      test_app = Celery(broker_url, config_source=test_config)
      test_execute = test_app.task(execute)
      patch_app = mock.patch(
          "airflow.providers.celery.executors.celery_executor.app",
          test_app,
      )
      patch_execute = mock.patch(
          "airflow.providers.celery.executors.celery_executor_utils.execute_command",
          test_execute,
      )
  
      backend = test_app.backend
  
      if hasattr(backend, "ResultSession"):
          # Pre-create the database tables now, otherwise SQLA vis Celery has a
          # race condition where it one of the subprocesses can die with "Table
          # already exists" error, because SQLA checks for which tables exist,
          # then issues a CREATE TABLE, rather than doing CREATE TABLE IF NOT
          # EXISTS
          session = backend.ResultSession()
          session.close()
  
      with patch_app, patch_execute:
          try:
              yield test_app
          finally:
              # Clear event loop to tear down each celery instance
              set_event_loop(None)
  
imports: from __future__ import annotations
  import contextlib
  import logging
  import os
  import signal
  import sys
  from datetime import datetime, timedelta
  from unittest import mock
  import celery.contrib.testing.tasks
  import pytest
  import time_machine
  from celery import Celery
  from celery.result import AsyncResult
  from kombu.asynchronous import set_event_loop
  from airflow.configuration import conf
  from airflow.models.baseoperator import BaseOperator
  from airflow.models.dag import DAG
  from airflow.models.taskinstance import TaskInstance, TaskInstanceKey
  from airflow.providers.celery.executors import celery_executor, celery_executor_utils, default_celery
  from airflow.providers.celery.executors.celery_executor import CeleryExecutor
  from airflow.utils import timezone
  from airflow.utils.state import State
  from tests.test_utils import db
  from tests.test_utils.config import conf_vars
label_desc: Use image node_id 2 for calling a global function with example usage: _prepare_app(broker_url, execute) without return types