code: def test_gridsearch(new_adult):
      """Test that ReweighingMeta works in a grid search."""
      X, y, sample_weight = new_adult
      rew = ReweighingMeta(
          LogisticRegression(solver="liblinear"), Reweighing()
      )
  
      # UGLY workaround for sklearn issue: https://stackoverflow.com/a/49598597
      def score_func(y_true, y_pred, sample_weight):
          return accuracy_score(
              y_true,
              y_pred,
              sample_weight=sample_weight.iloc[y_true.index],
          )
  
      scoring = make_scorer(score_func, sample_weight=sample_weight)
  
      params = {
          "estimator__C": [1, 10],
          "reweigher__prot_attr": ["sex"],
      }
  
      clf = GridSearchCV(rew, params, scoring=scoring, cv=5)
      # need to reset index for score_func to work
      clf.fit(X, y.reset_index(drop=True), sample_weight=sample_weight)
  
file_path: AIF360/tests/sklearn/test_reweighing.py
imports: import numpy
  from sklearn.linear_model import LogisticRegression
  from sklearn.model_selection import GridSearchCV
  from sklearn.metrics import accuracy_score, make_scorer
  from aif360.algorithms.preprocessing import Reweighing
  from aif360.sklearn.preprocessing import Reweighing, ReweighingMeta
label_desc: Use image node_id 3 for calling a global function with example usage: test_gridsearch(new_adult) and returns: accuracy_score