code: def test_gridsearch_pipeline(print_changed_only_false):
      # render a pipeline inside a gridsearch
      pp = _EstimatorPrettyPrinter(
          compact=True, indent=1, indent_at_name=True
      )
  
      pipeline = Pipeline([("reduce_dim", PCA()), ("classify", SVC())])
      N_FEATURES_OPTIONS = [2, 4, 8]
      C_OPTIONS = [1, 10, 100, 1000]
      param_grid = [
          {
              "reduce_dim": [PCA(iterated_power=7), NMF()],
              "reduce_dim__n_components": N_FEATURES_OPTIONS,
              "classify__C": C_OPTIONS,
          },
          {
              "reduce_dim": [SelectKBest(chi2)],
              "reduce_dim__k": N_FEATURES_OPTIONS,
              "classify__C": C_OPTIONS,
          },
      ]
      gspipline = GridSearchCV(
          pipeline, cv=3, n_jobs=1, param_grid=param_grid
      )
      expected = """
  GridSearchCV(cv=3, error_score='raise-deprecating',
               estimator=Pipeline(memory=None,
                                  steps=[('reduce_dim',
                                          PCA(copy=True, iterated_power='auto',
                                              n_components=None,
                                              random_state=None,
                                              svd_solver='auto', tol=0.0,
                                              whiten=False)),
                                         ('classify',
                                          SVC(C=1.0, cache_size=200,
                                              class_weight=None, coef0=0.0,
                                              decision_function_shape='ovr',
                                              degree=3, gamma='auto_deprecated',
                                              kernel='rbf', max_iter=-1,
                                              probability=False,
                                              random_state=None, shrinking=True,
                                              tol=0.001, verbose=False))]),
               iid='warn', n_jobs=1,
               param_grid=[{'classify__C': [1, 10, 100, 1000],
                            'reduce_dim': [PCA(copy=True, iterated_power=7,
                                               n_components=None,
                                               random_state=None,
                                               svd_solver='auto', tol=0.0,
                                               whiten=False),
                                           NMF(alpha=0.0, beta_loss='frobenius',
                                               init=None, l1_ratio=0.0,
                                               max_iter=200, n_components=None,
                                               random_state=None, shuffle=False,
                                               solver='cd', tol=0.0001,
                                               verbose=0)],
                            'reduce_dim__n_components': [2, 4, 8]},
                           {'classify__C': [1, 10, 100, 1000],
                            'reduce_dim': [SelectKBest(k=10,
                                                       score_func=<function chi2 at some_address>)],
                            'reduce_dim__k': [2, 4, 8]}],
               pre_dispatch='2*n_jobs', refit=True, return_train_score=False,
               scoring=None, verbose=0)"""
  
      expected = expected[1:]  # remove first \n
      repr_ = pp.pformat(gspipline)
      # Remove address of '<function chi2 at 0x.....>' for reproducibility
      repr_ = re.sub(
          "function chi2 at 0x.*>",
          "function chi2 at some_address>",
          repr_,
      )
      assert repr_ == expected
  
imports: import re
  from pprint import PrettyPrinter
  import numpy
  from sklearn.utils._pprint import _EstimatorPrettyPrinter
  from sklearn.linear_model import LogisticRegressionCV
  from sklearn.pipeline import make_pipeline
  from sklearn.base import BaseEstimator, TransformerMixin
  from sklearn.feature_selection import SelectKBest, chi2
  from sklearn import config_context
label_desc: Use image node_id 6 for calling a global function with example usage: test_gridsearch_pipeline(print_changed_only_false) without return types