code: def _labels_cost(Xnum, Xcat, centroids, num_dissim, cat_dissim, gamma, membship=None):
      
  
      n_points = Xnum.shape[0]
      Xnum = check_array(Xnum)
  
      cost = 0.
      labels = np.empty(n_points, dtype=np.uint16)
      for ipoint in range(n_points):
          # Numerical cost = sum of Euclidean distances
          num_costs = num_dissim(centroids[0], Xnum[ipoint])
          cat_costs = cat_dissim(centroids[1], Xcat[ipoint], X=Xcat, membship=membship)
          # Gamma relates the categorical cost to the numerical cost.
          tot_costs = num_costs + gamma * cat_costs
          clust = np.argmin(tot_costs)
          labels[ipoint] = clust
          cost += tot_costs[clust]
  
      return labels, cost
docs: Calculate labels and cost function given a matrix of points and
      a list of centroids for the k-prototypes algorithm.