def get_bind(self, mapper=None, clause=None):
<EOL>if mapper is not None:<EOL><INDENT>try:<EOL><INDENT>persist_selectable = mapper.persist_selectable<EOL><DEDENT>except AttributeError:<EOL><INDENT>persist_selectable = mapper.mapped_table<EOL><DEDENT>info = getattr(persist_selectable, '<STR_LIT:info>', {})<EOL>bind_key = info.get('<STR_LIT>')<EOL>if bind_key is not None:<EOL><INDENT>state = get_state(self.app)<EOL>return state.db.get_engine(self.app, bind=bind_key)<EOL><DEDENT><DEDENT>return SessionBase.get_bind(self, mapper, clause)<EOL>
Return the engine or connection for a given model or
        table, using the ``__bind_key__`` if it is set.