def _transaction_contexts_by_thread(context):
    transaction_contexts_by_thread = getattr(
        context, '_enginefacade_context', None)
    if transaction_contexts_by_thread is None:
        transaction_contexts_by_thread = \
            context._enginefacade_context = _TransactionContextTLocal()

    return transaction_contexts_by_thread
dataset/ETHPy150Open openstack/oslo.db/oslo_db/sqlalchemy/enginefacade.py/_transaction_contexts_by_thread/original