code: def get_readwrite_instance(cls, working_dir, restore=False, restore_block_height=None):
          
          log.warning("!!! Getting raw read/write DB instance !!!")
  
          import virtualchain_hooks
          db_path = virtualchain.get_db_filename(virtualchain_hooks, working_dir)
          db = BlockstackDB(db_path, DISPOSITION_RW, working_dir, get_genesis_block())
          rc = db.db_setup()
          if not rc:
              if restore:
                  # restore from backup instead of bailing out
                  log.debug("Restoring from unclean shutdown")
                  rc = db.db_restore(block_number=restore_block_height)
                  if rc:
                      return db
                  else:
                      log.error("Failed to restore from unclean shutdown")
  
              db.close()
              raise Exception("Failed to set up db")
  
          return db
docs: Get a read/write instance to the db, without the singleton check.
          Used for low-level operations like db restore.
          Not used in the steady state behavior of the system.