                  # to an instance instead of a pk (e.g., a `@property`).
                  value = getattr(value, 'pk', value)
  
                  return PKOnlyObject(pk=value)
              except AttributeError:
                  pass
  
          # Standard case, return the object instance.
          return super().get_attribute(instance)
  
      def get_choices(self, cutoff=None):
          queryset = self.get_queryset()
 
</s> remove             try:
 </s> add             with contextlib.suppress(AttributeError): </s> remove             try:
 </s> add             with contextlib.suppress(TypeError, ValueError): </s> remove             except FieldDoesNotExist:
                pass
 </s> add  </s> remove         except TypeError:  # Input is an unhashable type
            pass
 </s> add  </s> remove             try:
 </s> add             with contextlib.suppress(Exception):
                  # to an instance instead of a pk (e.g., a `@property`).
                  value = getattr(value, 'pk', value)
  
                  return PKOnlyObject(pk=value)



          # Standard case, return the object instance.
          return super().get_attribute(instance)
  
      def get_choices(self, cutoff=None):
          queryset = self.get_queryset()
keep keep keep keep replace replace replace keep keep keep keep keep
 Refactor: Replace try/except with contextlib.suppress() (#8676) 
rest_framework/relations.py