@classmethod
def aggregate(cls, items, mode):
    """
        Aggregates array of numbers by a given 'mode'
        """
    if mode == cls.AGG_MODE_MAX:
        return max(items)
    elif mode == cls.AGG_MODE_MIN:
        return min(items)
    elif mode == cls.AGG_MODE_AVG:
        return cls.round(sum(items) / len(items))
    elif mode == cls.AGG_MODE_DIFF:
        return cls.round(max(items) - min(items))
    else:
        raise ValueError("unknown mode: '{}'".format(mode))
