              return None
  
          output_format = getattr(self, 'format', api_settings.DATE_FORMAT)
  
          if output_format is None or isinstance(value, six.string_types):
              return value
  
          # Applying a `DateField` to a datetime value is almost always
          # not a sensible thing to do, as it means naively dropping
          # any explicit or implicit timezone info.
 
</s> remove         super(HyperlinkedRelatedField, self).__init__(**kwargs)
 </s> add         super().__init__(**kwargs) </s> remove         if value is None or value is '':
 </s> add         if value is None or value == '': </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             if isinstance(value, six.text_type):
 </s> add             if isinstance(value, str): </s> remove         value = six.text_type(data)
 </s> add         value = str(data)
        if output_format is None or isinstance(value, str):
              return None
  
          output_format = getattr(self, 'format', api_settings.DATE_FORMAT)
  
        if output_format is None or isinstance(value, str):
              return value
  
          # Applying a `DateField` to a datetime value is almost always
          # not a sensible thing to do, as it means naively dropping
          # any explicit or implicit timezone info.
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/fields.py