class Model: def update(self, dct): for key, value in dct.items(): if hasattr(self, key): setattr(self, key, value)