'Return the sum of the stats value for the given key
* indice: If indice is set, get the p[key][indice]
* mmm: display min, max, mean or current (if mmm=None)'

def __sum_stats(self, key, indice=None, mmm=None):

    ret = 0
    for p in self.stats:
        if (indice is None):
            ret += p[key]
        else:
            ret += p[key][indice]
    mmm_key = self.__mmm_key(key, indice)
    if (mmm == 'min'):
        try:
            if (self.mmm_min[mmm_key] > ret):
                self.mmm_min[mmm_key] = ret
        except AttributeError:
            self.mmm_min = {}
            return 0
        except KeyError:
            self.mmm_min[mmm_key] = ret
        ret = self.mmm_min[mmm_key]
    elif (mmm == 'max'):
        try:
            if (self.mmm_max[mmm_key] < ret):
                self.mmm_max[mmm_key] = ret
        except AttributeError:
            self.mmm_max = {}
            return 0
        except KeyError:
            self.mmm_max[mmm_key] = ret
        ret = self.mmm_max[mmm_key]
    return ret
