code: def test_tlcenter(rndstate, metric, sample_weight):
      """Test pipeline for recentering data to Identity"""
      # check if the global mean of the domains is indeed Identity
      rct = TLCenter(target_domain="target_domain", metric=metric)
      X, y_enc = make_classification_transfer(
          n_matrices=25, random_state=rndstate
      )
      if sample_weight:
          sample_weight_ = rndstate.rand(len(y_enc))
      else:
          sample_weight_ = None
      X_rct = rct.fit_transform(X, y_enc, sample_weight_)
      _, _, domain = decode_domains(X_rct, y_enc)
      for d in np.unique(domain):
          idx = domain == d
          Xd = X_rct[idx]
          if sample_weight:
              sample_weight_d = check_weights(
                  sample_weight_[idx], np.sum(idx)
              )
              Md = mean_covariance(
                  Xd, metric="riemann", sample_weight=sample_weight_d
              )
          else:
              Md = mean_covariance(Xd, metric="riemann")
          assert Md == pytest.approx(np.eye(2))
  
imports: import pytest
  from pytest import approx
  import numpy
  from numpy.testing import assert_array_equal
  from sklearn.model_selection import KFold, StratifiedShuffleSplit
  from sklearn.pipeline import make_pipeline, Pipeline
  from pyriemann.datasets.simulated import make_classification_transfer, make_matrices
  from pyriemann.classification import MDM, FgMDM, KNearestNeighbor, TSclassifier, SVC, MeanField
  from pyriemann.regression import KNearestNeighborRegressor, SVR
  from pyriemann.transfer import decode_domains, encode_domains, TLCenter, TLStretch, TLRotate, TLSplitter, TLClassifier, TLRegressor, MDWM
  from pyriemann.utils.distance import distance, distance_riemann
  from pyriemann.utils.mean import mean_covariance, mean_riemann
  from pyriemann.utils.utils import check_weights
label_desc: Use image node_id 2 for calling a global function with example usage: test_tlcenter(rndstate, metric, sample_weight) without return types