def METHOD_NAME(self, check=True, fail_fast=False) -> (dict, dict):
    """Generate statistics as a dictionary."""
    self._validate()
    for ms_name in self._results:
        self._statistics.setdefault(ms_name, {})[
            self.UNIT_KEY
        ] = self._measurements_defs[ms_name].unit
        has_data = Consumer.DATA_KEY in self._results[ms_name]
        st_defs = self._measurements_defs[ms_name].statistics
        for st_def in st_defs:
            if st_def.name not in self._results[ms_name]:
                if not has_data:
                    self._failure_aggregator.add_row(
                        f"Processing '{st_def.name}' statistic failed due "
                        f"to lack of data points for '{ms_name}' "
                        "measurement."
                    )
                    continue
                self._statistics[ms_name][st_def.name] = {
                    "value": st_def.func(self._results[ms_name][self.DATA_KEY])
                }
            else:
                self._statistics[ms_name][st_def.name] = {
                    "value": self._results[ms_name][st_def.name]
                }
            pass_criteria = st_def.pass_criteria
            if check and pass_criteria:
                # if the statistic definition contains a criteria but the
                # corresponding baseline is not defined, the test should fail.
                if pass_criteria.baseline == {}:
                    self._failure_aggregator.add_row(
                        f"Baseline data is not defined for '{ms_name}/{st_def.name}"
                        f"/{pass_criteria.name}'."
                    )
                    continue
                self._statistics[ms_name][st_def.name]["pass_criteria"] = {
                    pass_criteria.name: pass_criteria.baseline
                }
                res = self._statistics[ms_name][st_def.name]["value"]
                try:
                    pass_criteria.check(res)
                    self._statistics[ms_name][st_def.name]["outcome"] = "PASSED"
                except CriteriaException as err:
                    # pylint: disable=W0707
                    self._statistics[ms_name][st_def.name]["outcome"] = "FAILED"
                    fail_msg = f"'{ms_name}/{st_def.name}': {err}"
                    self._failure_aggregator.add_row(fail_msg)
                    if fail_fast:
                        raise self._failure_aggregator
    self._reset()
    if self._failure_aggregator.has_any():
        self._failure_aggregator.stats = self._statistics
        self._failure_aggregator.custom = self._custom
        raise self._failure_aggregator
    return self._statistics, self._custom