code: def _record_end(
      context: sa.engine.ExecutionContext, **kwargs: t.Any
  ) -> None:
      if not has_app_context():
          return
  
      if "_sqlalchemy_queries" not in g:
          g._sqlalchemy_queries = []
  
      import_top = current_app.import_name.partition(".")[0]
      import_dot = f"{import_top}."
      frame = inspect.currentframe()
  
      while frame:
          name = frame.f_globals.get("__name__")
  
          if name and (
              name == import_top or name.startswith(import_dot)
          ):
              code = frame.f_code
              location = f"{code.co_filename}:{frame.f_lineno} ({code.co_name})"
              break
  
          frame = frame.f_back
      else:
          location = "<unknown>"
  
      g._sqlalchemy_queries.append(
          _QueryInfo(
              statement=context.statement,
              parameters=context.parameters,
              start_time=context._fsa_start_time,  # type: ignore[attr-defined]
              end_time=perf_counter(),
              location=location,
          )
      )
  
file_path: flask-sqlalchemy/src/flask_sqlalchemy/record_queries.py
imports: from __future__ import annotations
  import dataclasses
  import inspect
  import typing
  from time import perf_counter
  import sqlalchemy
  import sqlalchemy.event
  from flask import current_app
  from flask import g
  from flask import has_app_context
label_desc: Use image node_id 4 for calling a global function with example usage: _record_end(context) without return types