code: def to_internal_value_single(self, data, serializer):
          
          related_model = serializer.Meta.model
          if isinstance(data, related_model):
              return data
          try:
              instance = related_model.objects.get(pk=data)
          except related_model.DoesNotExist:
              raise ValidationError(
                  "Invalid value for '%s': %s object with ID=%s not found" %
                  (self.field_name, related_model.__name__, data)
              )
          return instance
docs: Return the underlying object, given the serialized form.