'A context manager providing access to the current thread\'s
transaction stack. The context manager synchronizes access to
the stack map. Transactions should never migrate across threads.'

@contextlib.contextmanager
def _tx_stack(self):

    thread_id = threading.current_thread().ident
    with self._shared_map_lock:
        (yield self._tx_stacks[thread_id])
