def METHOD_NAME(self, request, *args, **kwargs):
    partial = kwargs.pop("partial", False)
    instance = self.get_object_or_none()
    serializer = self.get_serializer(instance, data=request.data, partial=partial)
    serializer.is_valid(raise_exception=True)
    if instance is None:
        lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_field
        lookup_value = self.kwargs[lookup_url_kwarg]
        extra_kwargs = {self.lookup_field: lookup_value}
        serializer.save(**extra_kwargs)
        return Response(serializer.data, status=status.HTTP_201_CREATED)
    serializer.save()
    return Response(serializer.data)