          Determine a default set of validators for any unique_together constraints.
          """
          model_class_inheritance_tree = (
              [self.Meta.model] +
              list(self.Meta.model._meta.parents.keys())
          )
  
          # The field names we're passing though here only include fields
          # which may map onto a model field. Any dotted field name lookups
          # cannot map to a field, and must be a traversal, so we're not
 
</s> remove         for parent_class in [model] + list(model._meta.parents.keys()):
 </s> add         for parent_class in [model] + list(model._meta.parents): </s> remove         assert set(serializer.data.keys()) == {'name1', 'name2', 'id'}
 </s> add         assert set(serializer.data) == {'name1', 'name2', 'id'} </s> remove                     ', '.join(["'" + fmt + "'" for fmt in self.renderer_classes.keys()])
 </s> add                     ', '.join(["'" + fmt + "'" for fmt in self.renderer_classes]) </s> remove         assert set(serializer.data.keys()) == {'name', 'ref'}
 </s> add         assert set(serializer.data) == {'name', 'ref'} </s> remove             list(declared_fields.keys()) +
            list(model_info.fields.keys()) +
            list(model_info.forward_relations.keys())
 </s> add             list(declared_fields) +
            list(model_info.fields) +
            list(model_info.forward_relations)
            list(self.Meta.model._meta.parents)
          Determine a default set of validators for any unique_together constraints.
          """
          model_class_inheritance_tree = (
              [self.Meta.model] +
            list(self.Meta.model._meta.parents)
          )
  
          # The field names we're passing though here only include fields
          # which may map onto a model field. Any dotted field name lookups
          # cannot map to a field, and must be a traversal, so we're not
keep keep keep keep replace keep keep keep keep keep
 Perfer iter(dict) over iter(dict.keys()) (#5736)

Calling dict.keys() is unnecessary. The two are functionally equivalent
on modern Pythons.

Inspired by Lennart Regebro's talk "Prehistoric Patterns in Python" from
PyCon 2017.

https://www.youtube.com/watch?v=V5-JH23Vk0I 
rest_framework/serializers.py