def release_readwrite_instance( cls, db_inst, block_number ):
        """
        Release the read/write instance of the blockstack db.
        This must be called after borrow_readwrite_instance, with the same block number.
        After this method completes, it's possible to call borrow_readwrite_instance again.

        Returns True on success
        Aborts on error
        """

        global blockstack_db, blockstack_db_lastblock, blockstack_db_lock 

        blockstack_db_lock.acquire()

        try:
            assert blockstack_db is not None, "Borrowing return violation: db is None"
            assert blockstack_db == db_inst, "Borrowing return violation: different instances"
            assert blockstack_db_lastblock == block_number, "Borrowing return violation: different blocks"
        except Exception, e:
            log.exception(e)
            log.error("FATAL: Borrowing-release violation")
            os.abort()

        blockstack_db.close()

        del blockstack_db
        del db_inst

        db_inst = None
        blockstack_db = None
        blockstack_db_lastblock = None 

        blockstack_db_lock.release()
        return True
Release the read/write instance of the blockstack db.
        This must be called after borrow_readwrite_instance, with the same block number.
        After this method completes, it's possible to call borrow_readwrite_instance again.

        Returns True on success
        Aborts on error