code: def select_from_cluster(idx_key, idx_list, measure_vect):
      
      best_idx = idx_key
      best_measure = measure_vect[idx_key]
      out_list = [idx_key] + idx_list
      for idx, measure in zip(idx_list, measure_vect[idx_list]):
          if measure < best_measure:
              best_idx = idx
              best_measure = measure
      out_list.remove(best_idx)
      return best_idx, out_list
docs: Select a single source from a cluster and make it the new cluster key
  
      Parameters
      ----------
      idx_key : int
        index of the current key for a cluster
  
      idx_list : [int,...]
        list of the other source indices in the cluster
  
      measure_vect : np.narray((nsrc),float)
        vector of the measure used to select the best source in the cluster
  
      returns best_idx:out_list
        where best_idx is the index of the best source in the cluster and
              out_list is the list of all the other indices