      def __getstate__(self):
          """
          Remove attributes from the response that shouldn't be cached.
          """
          state = super(Response, self).__getstate__()
          for key in (
              'accepted_renderer', 'renderer_context', 'resolver_match',
              'client', 'request', 'json', 'wsgi_request'
          ):
              if key in state:
 
</s> remove             six.text_type(key): key for key in self.choices
 </s> add             str(key): key for key in self.choices </s> remove             key = six.text_type(key)
 </s> add             key = str(key) </s> remove             for name, value in six.iteritems(headers):
 </s> add             for name, value in headers.items(): </s> remove         class MockQueryset(object):
 </s> add         class MockQueryset: </s> remove         assert isinstance(key, six.string_types)
 </s> add         assert isinstance(key, str)
        state = super().__getstate__()
      def __getstate__(self):
          """
          Remove attributes from the response that shouldn't be cached.
          """
        state = super().__getstate__()
          for key in (
              'accepted_renderer', 'renderer_context', 'resolver_match',
              'client', 'request', 'json', 'wsgi_request'
          ):
              if key in state:
keep keep keep keep replace keep keep keep keep keep
 Dropped Python 2 compatibility. (#6615)

Thanks to Jon Dufresne (@jdufresne) for review.

Co-authored-by: Asif Saif Uddin <auvipy@gmail.com>
Co-authored-by: Rizwan Mansuri <Rizwan@webbyfox.com> 
rest_framework/response.py