          if self.main_type == '*':
              return 0
          elif self.sub_type == '*':
              return 1
          elif not self.params or list(self.params.keys()) == ['q']:
              return 2
          return 3
  
      def __str__(self):
          ret = "%s/%s" % (self.main_type, self.sub_type)
 
</s> remove             items=coreschema.Enum(enum=list(field.choices.keys())),
 </s> add             items=coreschema.Enum(enum=list(field.choices)), </s> remove             enum=list(field.choices.keys()),
 </s> add             enum=list(field.choices), </s> remove     return [ret[item] for item in sorted(ret.keys())]
 </s> add     return [ret[item] for item in sorted(ret)] </s> remove         for key in self.params.keys():
 </s> add         for key in self.params: </s> remove         assert list(response.data['actions'].keys()) == ['PUT']
 </s> add         assert list(response.data['actions']) == ['PUT']
        elif not self.params or list(self.params) == ['q']:
          if self.main_type == '*':
              return 0
          elif self.sub_type == '*':
              return 1
        elif not self.params or list(self.params) == ['q']:
              return 2
          return 3
  
      def __str__(self):
          ret = "%s/%s" % (self.main_type, self.sub_type)
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/utils/mediatypes.py