code: def create_test_engine(
      path: Optional[str] = None, echo: bool = True
  ) -> Engine:
      """Creates a SQLAlchemy engine object for use in unit tests.
  
      Args:
          path: if None, use in-memory SQLite; else
              attempt to create a SQLite DB in the path provided.
          echo: if True, set engine to be verbose.
  
      Returns:
          Engine: an instance of SQLAlchemy engine.
  
      """
      if path is None:
          # From SQLALchemy docs:
          # "To use a SQLite :memory: database, specify an empty URL:
          # `engine = create_engine('sqlite://')`"
          # (https://docs.sqlalchemy.org/en/14/core/engines.html#sqlite)
          db_path = "sqlite://"
      else:
          db_path = "sqlite:///{path}".format(path=path)
      return create_engine(db_path, echo=echo)
  
file_path: Ax/ax/storage/sqa_store/db.py
imports: from __future__ import annotations
  from contextlib import contextmanager
  from typing import Any, Callable, Generator, Optional, TypeVar
  from sqlalchemy import create_engine
  from sqlalchemy.engine.base import Engine
  from sqlalchemy.ext.declarative import declarative_base
  from sqlalchemy.orm import scoped_session, Session, sessionmaker
label_desc: Use image node_id 3 for calling a global function with example usage: create_test_engine(path, echo) and returns: create_engine