'Begin a transaction. This transaction may be created while
another is active in a different thread.'

def __enter__(self):

    with self.db._tx_stack() as stack:
        first = (not stack)
        stack.append(self)
    if first:
        self.db._db_lock.acquire()
    return self
