code: def get_object(self, request, object_id):
          
          queryset = self.queryset(request)
          model = queryset.model
          try:
              object_id = model._meta.pk.to_python(object_id)
              return queryset.get(pk=object_id)
          except (model.DoesNotExist, ValidationError):
              return None
docs: Returns an instance matching the primary key provided. ``None``  is
          returned if no match is found (or the object_id failed validation
          against the primary key field).