def get_stats_result(self, request):
        """Return the StatsResult object for this statistic"""
        stats_datasets = StatsMakerDataverses(**request.GET.dict())

        pub_state = self.get_pub_state(request)

        if pub_state == self.PUB_STATE_ALL:
            stats_result = stats_datasets.get_dataverse_counts_by_month()
        elif pub_state == self.PUB_STATE_UNPUBLISHED:
            stats_result = stats_datasets.get_dataverse_counts_by_month_unpublished()
        else:
            stats_result = stats_datasets.get_dataverse_counts_by_month_published()

        return stats_result
def exiter_as(cls, new_exiter_fun: Callable[[Optional[Exiter]], Exiter]) -> Iterator[None]:
        """Temporarily override the global exiter.

        NB: We don't want to try/finally here, because we want exceptions to propagate
        with the most recent exiter installed in sys.excepthook.
        If we wrap this in a try:finally, exceptions will be caught and exiters unset.
        """
        previous_exiter = cls._exiter
        new_exiter = new_exiter_fun(previous_exiter)
        cls._reset_exiter(new_exiter)
        yield
        cls._reset_exiter(previous_exiter)