if session_factory is None: session_factory = _get_session
I'm pretty sure we have multiple code challenges on this. It doesn't do what you think it does! And regardless it wouldn't do that anyway because the engine and pool are created outside of this statement.