d = sch.distance.pdist(X)
L = sch.linkage(d, method='complete')
ind = sch.fcluster(L, 0.5 * d.max(), 'distance')
How to get flat clustering corresponding to color clusters in the dendrogram created by scipy