docs: def exists_in_table(session: Session, table_: Table, *criteria: Any) -> bool:
      """
      Implements an efficient way of detecting if a record or records exist;
      should be faster than ``COUNT(*)`` in some circumstances.
  
      Args:
          session: SQLAlchemy :class:`Session`, :class:`Engine`, or
              :class:`Connection` object
          table_: SQLAlchemy :class:`Table` object
          criteria: optional SQLAlchemy "where" criteria
  
      Returns:
          a boolean
  
      Prototypical use:
  
      .. code-block:: python
  
          return exists_in_table(session,
                                 table,
                                 column(fieldname1) == value2,
                                 column(fieldname2) == value2)
      """
      exists_clause = exists().select_from(table_)
      # ... EXISTS (SELECT * FROM tablename)
      for criterion in criteria:
          exists_clause = exists_clause.where(criterion)
      # ... EXISTS (SELECT * FROM tablename WHERE ...)
  
      if session.get_bind().dialect.name == SqlaDialectName.MSSQL:
          query = select([literal(True)]).where(exists_clause)
          # ... SELECT 1 WHERE EXISTS (SELECT * FROM tablename WHERE ...)
      else:
          query = select([exists_clause])
          # ... SELECT EXISTS (SELECT * FROM tablename WHERE ...)
  
      result = session.execute(query).scalar()
      return bool(result)