code: def get_db(db_state=Depends(reset_db_state)):
      try:
          database.db.connect()
          yield
      finally:
          if not database.db.is_closed():
              database.db.close()
  
file_path: fastapi/docs_src/sql_databases_peewee/sql_app/main.py
imports: import time
  from typing import List
  from fastapi import Depends, FastAPI, HTTPException
  from .None import crud, database, models, schemas
  from .database import db_state_default
label_desc: Use image node_id 1 for calling a global function with example usage: get_db(db_state) without return types