def _retain_centroids(numbers, thres):
    """Only keep one number for each cluster within thres of each other"""
    numbers.sort()
    prev = -1
    ret = []
    for n in numbers:
        if prev < 0 or n - prev > thres:
            ret.append(n)
            prev = n
    return ret
