code: def testing_engine(
      url=None,
      options=None,
      asyncio=False,
      transfer_staticpool=False,
      share_pool=False,
      _sqlite_savepoint=False,
  ):
      if asyncio:
          assert not _sqlite_savepoint
          from sqlalchemy.ext.asyncio import (
              create_async_engine as create_engine,
          )
      else:
          from sqlalchemy import create_engine
      from sqlalchemy.engine.url import make_url
  
      if not options:
          use_reaper = True
          scope = "function"
          sqlite_savepoint = False
      else:
          use_reaper = options.pop("use_reaper", True)
          scope = options.pop("scope", "function")
          sqlite_savepoint = options.pop("sqlite_savepoint", False)
  
      url = url or config.db.url
  
      url = make_url(url)
      if options is None:
          if (
              config.db is None
              or url.drivername == config.db.url.drivername
          ):
              options = config.db_opts
          else:
              options = {}
      elif (
          config.db is not None
          and url.drivername == config.db.url.drivername
      ):
          default_opt = config.db_opts.copy()
          default_opt.update(options)
  
      engine = create_engine(url, **options)
  
      if sqlite_savepoint and engine.name == "sqlite":
          # apply SQLite savepoint workaround
          @event.listens_for(engine, "connect")
          def do_connect(dbapi_connection, connection_record):
              dbapi_connection.isolation_level = None
  
          @event.listens_for(engine, "begin")
          def do_begin(conn):
              conn.exec_driver_sql("BEGIN")
  
      if transfer_staticpool:
          from sqlalchemy.pool import StaticPool
  
          if config.db is not None and isinstance(
              config.db.pool, StaticPool
          ):
              use_reaper = False
              engine.pool._transfer_from(config.db.pool)
      elif share_pool:
          engine.pool = config.db.pool
  
      if scope == "global":
          if asyncio:
              engine.sync_engine._has_events = True
          else:
              engine._has_events = (
                  True  # enable event blocks, helps with profiling
              )
  
      if isinstance(engine.pool, pool.QueuePool):
          engine.pool._timeout = 0
          engine.pool._max_overflow = 0
      if use_reaper:
          testing_reaper.add_engine(engine, scope)
  
      return engine
  
imports: from __future__ import annotations
  import collections
  import re
  import typing
  from typing import Any
  from typing import Dict
  from typing import Optional
  import warnings
  import weakref
  from .None import config
  from .util import decorator
  from .util import gc_collect
  from ..None import event
  from ..None import pool
  from ..util import await_
  from ..util.typing import Literal
label_desc: Use image node_id 9 for calling a global function with example usage: testing_engine(url, options, asyncio, transfer_staticpool, share_pool, _sqlite_savepoint) and returns: engine