  
      def get_attribute(self, instance):
          if self.use_pk_only_optimization() and self.source_attrs:
              # Optimized case, return a mock object only containing the pk attribute.
              try:
                  attribute_instance = get_attribute(instance, self.source_attrs[:-1])
                  value = attribute_instance.serializable_value(self.source_attrs[-1])
                  if is_simple_callable(value):
                      # Handle edge case where the relationship `source` argument
                      # points to a `get_relationship()` method on the model.
 
</s> remove             except AttributeError:
                pass

 </s> add  </s> remove             try:
 </s> add             with contextlib.suppress(TypeError, ValueError): </s> remove             except FieldDoesNotExist:
                pass
 </s> add  </s> remove             try:
 </s> add             with contextlib.suppress(KeyError, ValueError, TypeError): </s> remove             try:
 </s> add             with contextlib.suppress(FieldDoesNotExist):
            with contextlib.suppress(AttributeError):
  
      def get_attribute(self, instance):
          if self.use_pk_only_optimization() and self.source_attrs:
              # Optimized case, return a mock object only containing the pk attribute.
            with contextlib.suppress(AttributeError):
                  attribute_instance = get_attribute(instance, self.source_attrs[:-1])
                  value = attribute_instance.serializable_value(self.source_attrs[-1])
                  if is_simple_callable(value):
                      # Handle edge case where the relationship `source` argument
                      # points to a `get_relationship()` method on the model.
keep keep keep keep replace keep keep keep keep keep
 Refactor: Replace try/except with contextlib.suppress() (#8676) 
rest_framework/relations.py