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