code: def _estimator_fit(data, estimator, method=None):
      """Estimator to fit on the data matrix.
  
      Parameters
      ----------
      data : numpy array
          Data matrix.
  
      estimator : instance of estimator from sklearn
          MiniBatchKMeans or AgglomerativeClustering.
  
      method: str,
      {'kmeans', 'ward', 'complete', 'average', 'rena', 'hierarchical_kmeans'},
      optional
  
          A method to choose between for brain parcellations.
  
      Returns
      -------
      labels_ : numpy.ndarray
          labels_ estimated from estimator.
  
      """
      if method == "rena":
          rena = ReNA(
              mask_img=estimator.mask_img,
              n_clusters=estimator.n_clusters,
              scaling=estimator.scaling,
              n_iter=estimator.n_iter,
              threshold=estimator.threshold,
              memory=estimator.memory,
              memory_level=estimator.memory_level,
              verbose=estimator.verbose,
          )
          rena.fit(data)
          labels_ = rena.labels_
  
      else:
          estimator = clone(estimator)
          estimator.fit(data.T)
          labels_ = estimator.labels_
  
      return labels_
  
imports: import warnings
  import numpy
  from joblib import Memory, Parallel, delayed
  from sklearn.base import clone
  from sklearn.feature_extraction import image
  from nilearn.maskers import NiftiLabelsMasker
  from .._utils import fill_doc, stringify_path
  from .._utils.niimg import safe_get_data
  from .._utils.niimg_conversions import iter_check_niimg
  from ..decomposition._multi_pca import _MultiPCA
  from .hierarchical_kmeans_clustering import HierarchicalKMeans
  from .rena_clustering import ReNA
label_desc: Use image node_id 1 for calling a global function with example usage: _estimator_fit(data, estimator, method) and returns: labels_