Implement Clustering Algorithm Python