def upgrade(cls, db_old):
        "Upgrades the base version of a database into the child version."
        assert isinstance(db_old, cls.__base__), \
            'Can only upgrade Database objects!'
        db_new = cls()
        db_new.__setstate__(db_old.__getstate__())
        db_new.save(db_old._Database__path)
        db_old.__init__()
        return db_new
Upgrades the base version of a database into the child version.
recipes/Python/577825_Rudimentary_Database_Engine/recipe-577825.py