def cluster_distance(cluster1, cluster2, distance_agg=min):
 return distance_agg([distance(input1, input2) for input1 in get_values(cluster1) for input2 in get_values(cluster2)])

def cluster_distance ( cluster1 , cluster2 , distance_agg = min ) : return distance_agg ( [ distance ( input1 , input2 ) for input1 in get_values ( cluster1 ) for input2 in get_values ( cluster2 ) ] )
finds the aggregate distance between elements of cluster1 and elements of cluster2 .