code: def _clause_to_engine(
      clause: sa.ClauseElement | None,
      engines: t.Mapping[str | None, sa.engine.Engine],
  ) -> sa.engine.Engine | None:
      """If the clause is a table, return the engine associated with the table's
      metadata's bind key.
      """
      table = None
  
      if clause is not None:
          if isinstance(clause, sa.Table):
              table = clause
          elif isinstance(clause, sa.UpdateBase) and isinstance(
              clause.table, sa.Table
          ):
              table = clause.table
  
      if table is not None and "bind_key" in table.metadata.info:
          key = table.metadata.info["bind_key"]
  
          if key not in engines:
              raise sa_exc.UnboundExecutionError(
                  f"Bind key '{key}' is not in 'SQLALCHEMY_BINDS' config."
              )
  
          return engines[key]
  
      return None
  
file_path: flask-sqlalchemy/src/flask_sqlalchemy/session.py
imports: from __future__ import annotations
  import typing
  import sqlalchemy
  import sqlalchemy.exc
  import sqlalchemy.orm
  from flask.globals import app_ctx
label_desc: Use image node_id 1 for calling a global function with example usage: _clause_to_engine(clause, engines) and returns: None, engines