              renderer = self.renderer_classes[format]()
              ret = renderer.render(data)
  
              # Determine the content-type header from the renderer
              content_type = "{0}; charset={1}".format(
                  renderer.media_type, renderer.charset
              )
  
              # Coerce text to bytes if required.
              if isinstance(ret, six.text_type):
 
</s> remove             if isinstance(ret, six.text_type):
 </s> add             if isinstance(ret, str): </s> remove         if isinstance(ret, six.text_type):
 </s> add         if isinstance(ret, str): </s> remove             content_type = "{0}; charset={1}".format(media_type, charset)
 </s> add             content_type = "{}; charset={}".format(media_type, charset) </s> remove         if isinstance(ret, six.text_type):
 </s> add         if isinstance(ret, str): </s> remove             for name, value in six.iteritems(headers):
 </s> add             for name, value in headers.items():
            content_type = "{}; charset={}".format(
              renderer = self.renderer_classes[format]()
              ret = renderer.render(data)
  
              # Determine the content-type header from the renderer
            content_type = "{}; charset={}".format(
                  renderer.media_type, renderer.charset
              )
  
              # Coerce text to bytes if required.
              if isinstance(ret, six.text_type):
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/test.py