                  setattr(instance, key, val)
  
          else:
              instance = self.opts.model(**attrs)
  
          # Any relations that cannot be set until we've
          # saved the model get hidden away on these
 
</s> remove         for field in self.opts.model._meta.many_to_many:
 </s> add         for field in meta.many_to_many: </s> remove         # Reverse fk relations
        for (obj, model) in self.opts.model._meta.get_all_related_objects_with_model():
 </s> add         # Reverse fk or one-to-one relations
        for (obj, model) in meta.get_all_related_objects_with_model(): </s> remove         for (obj, model) in self.opts.model._meta.get_all_related_m2m_objects_with_model():
 </s> add         for (obj, model) in meta.get_all_related_m2m_objects_with_model():
        # ...or create a new instance
                  setattr(instance, key, val)
  
        # ...or create a new instance
          else:
              instance = self.opts.model(**attrs)
  
          # Any relations that cannot be set until we've
          # saved the model get hidden away on these
keep add keep keep keep keep keep
 Clean up and comment `restore_object` 
rest_framework/serializers.py