_MIGRATIONS = {} def migrate(data): while data["version"] in _MIGRATIONS: data = _MIGRATIONS[data["version"]](data) return data