kmeans.py modified