          # On python 2.x json.dumps() returns bytestrings if ensure_ascii=True,
          # but if ensure_ascii=False, the return type is underspecified,
          # and may (or may not) be unicode.
          # On python 3.x json.dumps() returns unicode strings.
          if isinstance(ret, six.text_type):
              # We always fully escape \u2028 and \u2029 to ensure we output JSON
              # that is a strict javascript subset. If bytes were returned
              # by json.dumps() then we don't have these characters in any case.
              # See: http://timelessrepo.com/json-isnt-a-javascript-subset
              ret = ret.replace('\u2028', '\\u2028').replace('\u2029', '\\u2029')
 
</s> remove             if isinstance(value, six.text_type):
 </s> add             if isinstance(value, str): </s> remove def unicode_repr(instance):
    # Get the repr of an instance, but ensure it is a unicode string
    # on both python 3 (already the case) and 2 (not the case).
    if six.PY2:
        return repr(instance).decode('utf-8')
    return repr(instance)


def unicode_to_repr(value):
    # Coerce a unicode string to the correct repr return type, depending on
    # the Python version. We wrap all our `__repr__` implementations with
    # this and then use unicode throughout internally.
    if six.PY2:
        return value.encode('utf-8')
    return value


 </s> add  </s> remove         ret = super(ListSerializer, self).errors
 </s> add         ret = super().errors </s> remove         ret = super(Serializer, self).errors
 </s> add         ret = super().errors </s> remove             content_type = "{0}; charset={1}".format(
 </s> add             content_type = "{}; charset={}".format(
        if isinstance(ret, str):
          # On python 2.x json.dumps() returns bytestrings if ensure_ascii=True,
          # but if ensure_ascii=False, the return type is underspecified,
          # and may (or may not) be unicode.
          # On python 3.x json.dumps() returns unicode strings.
        if isinstance(ret, str):
              # We always fully escape \u2028 and \u2029 to ensure we output JSON
              # that is a strict javascript subset. If bytes were returned
              # by json.dumps() then we don't have these characters in any case.
              # See: http://timelessrepo.com/json-isnt-a-javascript-subset
              ret = ret.replace('\u2028', '\\u2028').replace('\u2029', '\\u2029')
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