k-means algorithm implemented in python