code: def cached_app(config=None, testing=False):
      """Return cached instance of Airflow Internal API app."""
      global app
      if not app:
          app = create_app(config=config, testing=testing)
      return app
  
imports: from __future__ import annotations
  import logging
  import os
  import signal
  import subprocess
  import sys
  import textwrap
  from contextlib import suppress
  from pathlib import Path
  from tempfile import gettempdir
  from time import sleep
  import psutil
  from flask import Flask
  from flask_appbuilder import SQLA
  from flask_caching import Cache
  from flask_wtf.csrf import CSRFProtect
  from lockfile.pidlockfile import read_pid_from_pidfile
  from sqlalchemy.engine.url import make_url
  from airflow import settings
  from airflow.api_internal.internal_api_call import InternalApiConfig
  from airflow.cli.commands.daemon_utils import run_command_with_daemon_option
  from airflow.cli.commands.webserver_command import GunicornMonitor
  from airflow.configuration import conf
  from airflow.exceptions import AirflowConfigException
  from airflow.logging_config import configure_logging
  from airflow.models import import_all_models
  from airflow.utils import cli
  from airflow.utils.cli import setup_locations
  from airflow.utils.providers_configuration_loader import providers_configuration_loaded
  from airflow.www.extensions.init_dagbag import init_dagbag
  from airflow.www.extensions.init_jinja_globals import init_jinja_globals
  from airflow.www.extensions.init_manifest_files import configure_manifest_files
  from airflow.www.extensions.init_security import init_xframe_protection
  from airflow.www.extensions.init_views import init_api_internal, init_error_handlers
label_desc: Use image node_id 3 for calling a global function with example usage: cached_app(config, testing) and returns: app