code: def _clear_db(request):
      from tests.test_utils.db import clear_all
  
      """Clear DB before each test module run."""
      if not request.config.option.db_cleanup:
          return
      if skip_db_tests:
          return
      from airflow.configuration import conf
  
      sql_alchemy_conn = conf.get("database", "sql_alchemy_conn")
      if sql_alchemy_conn.startswith("sqlite"):
          sql_alchemy_file = sql_alchemy_conn.replace("sqlite:///", "")
          if not os.path.exists(sql_alchemy_file):
              print(
                  f"The sqlite file `{sql_alchemy_file}` does not exist. Attempt to initialize it."
              )
              initial_db_init()
  
      dist_option = getattr(request.config.option, "dist", "no")
      if dist_option != "no" or hasattr(request.config, "workerinput"):
          # Skip if pytest-xdist detected (controller or worker)
          return
  
      try:
          clear_all()
      except Exception as ex:
          exc_name_parts = [type(ex).__name__]
          exc_module = type(ex).__module__
          if exc_module != "builtins":
              exc_name_parts.insert(0, exc_module)
          extra_msg = (
              ""
              if request.config.option.db_init
              else ", try to run with flag --with-db-init"
          )
          pytest.exit(
              f"Unable clear test DB{extra_msg}, got error {'.'.join(exc_name_parts)}: {ex}"
          )
  
imports: from __future__ import annotations
  import json
  import os
  import platform
  import subprocess
  import sys
  import warnings
  from contextlib import ExitStack, suppress
  from datetime import datetime, timedelta
  from pathlib import Path
  from typing import TYPE_CHECKING
  import pytest
  import time_machine
  from itsdangerous import URLSafeSerializer
label_desc: Use image node_id 36 for calling a global function with example usage: _clear_db(request) without return types