          # negotiation with default renderers.
          self.renderer_classes = api_settings.DEFAULT_RENDERER_CLASSES
          neg = self.perform_content_negotiation(self.request, force=True)
          self.request.accepted_renderer, self.request.accepted_media_type = neg
          return super(SchemaView, self).handle_exception(exc)
 
</s> remove         super(SchemaView, self).__init__(*args, **kwargs)
 </s> add         super().__init__(*args, **kwargs) </s> remove             if isinstance(urlconf, six.string_types):
 </s> add             if isinstance(urlconf, str): </s> remove         super(APIRequestFactory, self).__init__(**defaults)
 </s> add         super().__init__(**defaults) </s> remove         expected = {'target': [u'one to one pk source with this target already exists.']}
 </s> add         expected = {'target': ['one to one pk source with this target already exists.']} </s> remove         # python 2 hasattr fails for *any* exception, not just AttributeError
        if six.PY2:
            return

 </s> add 
        return super().handle_exception(exc)
          # negotiation with default renderers.
          self.renderer_classes = api_settings.DEFAULT_RENDERER_CLASSES
          neg = self.perform_content_negotiation(self.request, force=True)
          self.request.accepted_renderer, self.request.accepted_media_type = neg
        return super().handle_exception(exc)
keep keep keep keep replace
 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/schemas/views.py