              except (AttributeError, KeyError) as exc:
                  # If we raised an Attribute or KeyError here it'd get treated
                  # as an omitted field in `Field.get_attribute()`. Instead we
                  # raise a ValueError to ensure the exception is not masked.
                  raise ValueError('Exception raised in callable attribute "{0}"; original exception was: {1}'.format(attr, exc))
  
      return instance
  
  
  def set_value(dictionary, keys, value):
 
</s> remove class BadType(object):
 </s> add class BadType: </s> remove         return unicode_to_repr(representation.list_repr(self, indent=1))
 </s> add         return representation.list_repr(self, indent=1) </s> remove         if isinstance(ret, six.text_type):
 </s> add         if isinstance(ret, str): </s> remove         class AuthRaisesAttributeError(object):
 </s> add         class AuthRaisesAttributeError: </s> remove @python_2_unicode_compatible
class PKOnlyObject(object):
 </s> add class PKOnlyObject:
                raise ValueError('Exception raised in callable attribute "{}"; original exception was: {}'.format(attr, exc))
              except (AttributeError, KeyError) as exc:
                  # If we raised an Attribute or KeyError here it'd get treated
                  # as an omitted field in `Field.get_attribute()`. Instead we
                  # raise a ValueError to ensure the exception is not masked.
                raise ValueError('Exception raised in callable attribute "{}"; original exception was: {}'.format(attr, exc))
  
      return instance
  
  
  def set_value(dictionary, keys, value):
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