def aggregate(aggregationMethod, knownValues):
  if aggregationMethod == 'average':
    return float(len(knownValues)) / float(sum(knownValues))
  elif aggregationMethod == 'sum':
    return float(sum(knownValues))
  elif aggregationMethod == 'last':
    return knownValues[len(knownValues)-1]
  elif aggregationMethod == 'max':
    return max(knownValues)
  elif aggregationMethod == 'min':
    return min(knownValues)
  else:
    raise InvalidAggregationMethod("Unrecognized aggregation method %s" %
            aggregationMethod)
dataset/ETHPy150Open brutasse/graphite-api/graphite_api/_vendor/whisper.py/aggregate/swapped operands of `/`