<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def find_dist_to_centroids(cluster_dict, cvects, weights=None):
 """ Find the centroids and the distances to the centroid for all sources in a set of clusters Parameters Each cluster is a source index and the list of other sources in the cluster. cvects : np.ndarray(3,nsrc) Directional cosines (i.e., x,y,z component) values of all the sources weights : ~numpy.ndarray(nsrc) with the weights to use. None for equal weighting Returns distances : ~numpy.ndarray(nsrc) with the distances to the centroid of the cluster. 0 for unclustered sources cent_dict : dict(int:numpy.ndarray(2)), dictionary for the centroid locations """

    distances = np.zeros((cvects.shape[1]))
    cent_dict = {}
    for k, v in cluster_dict.items():
        l = [k] + v
        distances[l], centroid = find_dist_to_centroid(cvects, l, weights)
        cent_dict[k] = make_lat_lons(centroid)
    return distances, cent_dict