                  list(kwargs.items())
              )
  
          if self.instance is not None:
              self.update(self.instance, validated_data)
          else:
              self.instance = self.create(validated_data)
              assert self.instance is not None, (
                  '`create()` did not return an object instance.'
              )
 
</s> remove     def create(self, attrs):
 </s> add     def create(self, validated_attrs): </s> remove         # Remove many-to-many relationships from attrs.
 </s> add         # Remove many-to-many relationships from validated_attrs. </s> remove         instance = ModelClass.objects.create(**attrs)
 </s> add         instance = ModelClass.objects.create(**validated_attrs) </s> remove             if relation_info.to_many and (field_name in attrs):
                many_to_many[field_name] = attrs.pop(field_name)
 </s> add             if relation_info.to_many and (field_name in validated_attrs):
                many_to_many[field_name] = validated_attrs.pop(field_name)
            self.instance = self.update(self.instance, validated_data)
            assert self.instance is not None, (
                '`update()` did not return an object instance.'
            )
                  list(kwargs.items())
              )
  
          if self.instance is not None:
            self.instance = self.update(self.instance, validated_data)
            assert self.instance is not None, (
                '`update()` did not return an object instance.'
            )
          else:
              self.instance = self.create(validated_data)
              assert self.instance is not None, (
                  '`create()` did not return an object instance.'
              )
keep keep keep keep replace keep keep keep keep keep
 Tweak pre/post save hooks. Return instance in .update(). 
rest_framework/serializers.py