code: def bool_from_exists_clause(session: Session,
                              exists_clause: Exists) -> bool:
        # noqa
      if session.get_bind().dialect.name == SqlaDialectName.MSSQL:
          # SQL Server
          result = session.query(literal(True)).filter(exists_clause).scalar()
      else:
          # MySQL, etc.
          result = session.query(exists_clause).scalar()
      return bool(result)
docs: Database dialects are not consistent in how ``EXISTS`` clauses can be
      converted to a boolean answer. This function manages the inconsistencies.
  
      See:
      
      - https://bitbucket.org/zzzeek/sqlalchemy/issues/3212/misleading-documentation-for-queryexists
      - http://docs.sqlalchemy.org/en/latest/orm/query.html#sqlalchemy.orm.query.Query.exists
      
      Specifically, we want this:
      
      *SQL Server*
      
      .. code-block:: sql
      
          SELECT 1 WHERE EXISTS (SELECT 1 FROM table WHERE ...)
          -- ... giving 1 or None (no rows)
          -- ... fine for SQL Server, but invalid for MySQL (no FROM clause)
          
      *Others, including MySQL*
      
      .. code-block:: sql
      
          SELECT EXISTS (SELECT 1 FROM table WHERE ...)
          -- ... giving 1 or 0
          -- ... fine for MySQL, but invalid syntax for SQL Server