<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_image_set(self):
 """ Obtain existing ImageSet if `pk` is specified, otherwise create a new ImageSet for the user. """

        image_set_pk = self.kwargs.get("pk", None)
        if image_set_pk is None:
            return self.request.user.image_sets.create()
        return get_object_or_404(self.get_queryset(), pk=image_set_pk)