def get_result(self, key, date_range=None, reduce=True, verbose_results=False):
        """
        If your Calculator does not have a window set, you must pass a tuple of
        date or datetime objects to date_range
        """
        if verbose_results:
            assert not reduce, "can't have reduce set for verbose results"

        if date_range is not None:
            start, end = date_range
        elif self.window:
            now = self.fluff.get_now()
            start = now - self.window
            end = now
        result = {}
        for emitter_name in self._fluff_emitters:
            shared_key = [self.fluff._doc_type] + key + [self.slug, emitter_name]
            emitter = getattr(self, emitter_name)
            emitter_type = emitter._fluff_emitter
            q_args = {
                'reduce': reduce,
            }
            if emitter_type == 'date':
                assert isinstance(date_range, tuple) or self.window, (
                    "You must either set a window on your Calculator "
                    "or pass in a date range")
                if start > end:
                    q_args['descending'] = True
                q = self.fluff.view(
                    'fluff/generic',
                    startkey=shared_key + [json_format_date(start)],
                    endkey=shared_key + [json_format_date(end)],
                    **q_args
                ).all()
            elif emitter_type == 'null':
                q = self.fluff.view(
                    'fluff/generic',
                    key=shared_key + [None],
                    **q_args
                ).all()
            else:
                raise EmitterTypeError(
                    'emitter type %s not recognized' % emitter_type
                )

            if reduce:
                try:
                    result[emitter_name] = q[0]['value'][emitter._reduce_type]
                except __HOLE__:
                    result[emitter_name] = 0
            else:
                # clean ids
                def strip(id_string):
                    prefix = '%s-' % self.fluff.__name__
                    assert id_string.startswith(prefix)
                    return id_string[len(prefix):]
                for row in q:
                    row['id'] = strip(row['id'])

                if not verbose_results:
                    # strip down to ids
                    result[emitter_name] = [row['id'] for row in q]
                else:
                    result[emitter_name] = q

        return result
dataset/ETHPy150Open dimagi/commcare-hq/corehq/ex-submodules/fluff/calculators.py/Calculator.get_result