                  (field.name, field.verbose_name) for field in queryset.model._meta.fields
              ]
              valid_fields += [
                  (key, key.title().split('__'))
                  for key in queryset.query.annotations.keys()
              ]
          else:
              valid_fields = [
                  (item, item) if isinstance(item, six.string_types) else item
                  for item in valid_fields
 
</s> remove     return [ret[item] for item in sorted(ret.keys())]
 </s> add     return [ret[item] for item in sorted(ret)] </s> remove         columns = [key for key in header.keys() if key != 'url']
        details = [key for key in header.keys() if key != 'url']
 </s> add         columns = [key for key in header if key != 'url']
        details = [key for key in header if key != 'url'] </s> remove         for key in kwargs.keys():
 </s> add         for key in kwargs: </s> remove             actions = set(callback.actions.keys())
 </s> add             actions = set(callback.actions) </s> remove             for key in list(field_kwargs.keys()):
 </s> add             for key in list(field_kwargs):
                for key in queryset.query.annotations
                  (field.name, field.verbose_name) for field in queryset.model._meta.fields
              ]
              valid_fields += [
                  (key, key.title().split('__'))
                for key in queryset.query.annotations
              ]
          else:
              valid_fields = [
                  (item, item) if isinstance(item, six.string_types) else item
                  for item in valid_fields
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/filters.py