              content_type = media_type
          self['Content-Type'] = content_type
  
          ret = renderer.render(self.data, accepted_media_type, context)
          if isinstance(ret, six.text_type):
              assert charset, (
                  'renderer returned unicode, and did not specify '
                  'a charset value.'
              )
              return bytes(ret.encode(charset))
 
</s> remove             content_type = "{0}; charset={1}".format(media_type, charset)
 </s> add             content_type = "{}; charset={}".format(media_type, charset) </s> remove             content_type = "{0}; charset={1}".format(
 </s> add             content_type = "{}; charset={}".format( </s> remove             if isinstance(ret, six.text_type):
 </s> add             if isinstance(ret, str): </s> remove         context = super(AdminRenderer, self).get_context(
 </s> add         context = super().get_context( </s> remove         ret = super(ListSerializer, self).errors
 </s> add         ret = super().errors
        if isinstance(ret, str):
              content_type = media_type
          self['Content-Type'] = content_type
  
          ret = renderer.render(self.data, accepted_media_type, context)
        if isinstance(ret, str):
              assert charset, (
                  'renderer returned unicode, and did not specify '
                  'a charset value.'
              )
              return bytes(ret.encode(charset))
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