          paths = {}
  
          tag = None
          for name, link in document.links.items():
              path = urlparse.urlparse(link.url).path
              method = link.action.lower()
              paths.setdefault(path, {})
              paths[path][method] = self.get_operation(link, name, tag=tag)
  
          for tag, section in document.data.items():
 
</s> remove                 path = urlparse.urlparse(link.url).path
 </s> add                 path = parse.urlparse(link.url).path </s> remove             for name, value in six.iteritems(headers):
 </s> add             for name, value in headers.items(): </s> remove             key = six.text_type(key)
 </s> add             key = str(key) </s> remove         return super(SerializerMetaclass, cls).__new__(cls, name, bases, attrs)
 </s> add         return super().__new__(cls, name, bases, attrs) </s> remove class BaseTokenAuthTests(object):
 </s> add class BaseTokenAuthTests:
            path = parse.urlparse(link.url).path
          paths = {}
  
          tag = None
          for name, link in document.links.items():
            path = parse.urlparse(link.url).path
              method = link.action.lower()
              paths.setdefault(path, {})
              paths[path][method] = self.get_operation(link, name, tag=tag)
  
          for tag, section in document.data.items():
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/renderers.py