<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def refresh_model(self, model, *, overwrite=False):
 """Pulls the model's record from the database. If overwrite is True, the model values are overwritten and returns the model, otherwise a new model instance with the newer record is returned. """

    new_model = self.find_model_by_id(model.__class__, model.primary_key)
    if overwrite:
      model.update(new_model.to_dict(use_default_excludes=False))
      return model
    else:
      return new_model