          unique_constraint_names -= {None}
  
          # Include each of the `unique_together` field names,
          # so long as all the field names are included on the serializer.
          for parent_class in [model] + list(model._meta.parents.keys()):
              for unique_together_list in parent_class._meta.unique_together:
                  if set(field_names).issuperset(set(unique_together_list)):
                      unique_constraint_names |= set(unique_together_list)
  
          # Now we have all the field names that have uniqueness constraints
 
</s> remove             list(self.Meta.model._meta.parents.keys())
 </s> add             list(self.Meta.model._meta.parents) </s> remove             six.text_type(key): key for key in self.choices.keys()
 </s> add             six.text_type(key): key for key in self.choices </s> remove                     ', '.join(["'" + fmt + "'" for fmt in self.renderer_classes.keys()])
 </s> add                     ', '.join(["'" + fmt + "'" for fmt in self.renderer_classes]) </s> remove             for key in list(field_kwargs.keys()):
 </s> add             for key in list(field_kwargs): </s> remove         assert set(serializer.data.keys()) == {'name', 'ref'}
 </s> add         assert set(serializer.data) == {'name', 'ref'}
        for parent_class in [model] + list(model._meta.parents):
          unique_constraint_names -= {None}
  
          # Include each of the `unique_together` field names,
          # so long as all the field names are included on the serializer.
        for parent_class in [model] + list(model._meta.parents):
              for unique_together_list in parent_class._meta.unique_together:
                  if set(field_names).issuperset(set(unique_together_list)):
                      unique_constraint_names |= set(unique_together_list)
  
          # Now we have all the field names that have uniqueness constraints
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