python implementation of the K-means and Average Linkage algorithms