def reducer_factory(reducer, k=3):
    if (reducer == 'max'):
        return Max()
    elif (reducer == 'average'):
        return Average()
    elif (reducer == 'topK'):
        return TopKAverage(k)
def reducer_factory(reducer, k=3):
    if (reducer == 'max'):
        return Max()
    elif (reducer == 'average'):
        return Average()
    elif (reducer == 'topK'):
        return TopKAverage(k)