code: def predict(self, X):
          
          if isinstance(X, np.ndarray):
              if not (X.dtype == 'float32' or X.dtype == 'float64'):
                  X = X.astype('float64')
          labels, inertia = libdistance.assign_nearest(
              X, self.cluster_centers_, metric=self.metric)
          return labels
docs: Predict the closest cluster each sample in X belongs to.
  
          In the vector quantization literature, `cluster_centers_` is called
          the code book and each value returned by `predict` is the index of
          the closest code in the code book.
  
          Parameters
          ----------
          X : array-like, shape = [n_samples, n_features]
              New data to predict.
  
          Returns
          -------
          Y : array, shape [n_samples,]
              Index of the closest center each sample belongs to.