              paths[path][method] = self.get_operation(link, name, tag=tag)
  
          for tag, section in document.data.items():
              for name, link in section.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)
  
          return paths
 
</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         return super(SerializerMetaclass, cls).__new__(cls, name, bases, attrs)
 </s> add         return super().__new__(cls, name, bases, attrs) </s> remove class DynamicListRoute(object):
 </s> add class DynamicListRoute: </s> remove class DynamicDetailRoute(object):
 </s> add class DynamicDetailRoute:
                path = parse.urlparse(link.url).path
              paths[path][method] = self.get_operation(link, name, tag=tag)
  
          for tag, section in document.data.items():
              for name, link in section.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)
  
          return paths
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