def METHOD_NAME(self, queryset=None):
    try:
        return super().METHOD_NAME(queryset=queryset)
    except Http404:
        # TODO: remove after the migration has completed.
        # To avoid blocking users from redeeming invitations while
        # the data migration is running, we migrate those on the fly.
        team_invite = get_object_or_404(
            TeamInvite.objects.filter(teammember__member__isnull=True),
            hash=self.kwargs[self.slug_url_kwarg],
        )
        invitation, _ = team_invite.migrate()
        team_invite.delete()
        return invitation