<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update(self, commit=True, **kwargs):
 """ Update model attributes and save to database """


        for (attr, value) in kwargs.iteritems():
            setattr(self, attr, value)
        return commit and self.save() or self