          # Map the string representation of choices to the underlying value.
          # Allows us to deal with eg. integer choices while supporting either
          # integer or string input, but still get the correct datatype out.
          self.choice_strings_to_values = {
              six.text_type(key): key for key in self.choices.keys()
          }
  
      choices = property(_get_choices, _set_choices)
  
  
 
</s> remove             for key in list(field_kwargs.keys()):
 </s> add             for key in list(field_kwargs): </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             list(self.Meta.model._meta.parents.keys())
 </s> add             list(self.Meta.model._meta.parents) </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'}
            six.text_type(key): key for key in self.choices
          # Map the string representation of choices to the underlying value.
          # Allows us to deal with eg. integer choices while supporting either
          # integer or string input, but still get the correct datatype out.
          self.choice_strings_to_values = {
            six.text_type(key): key for key in self.choices
          }
  
      choices = property(_get_choices, _set_choices)
  
  
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/fields.py