code: def get_generic_regressor(
      cv,
      X,
      Y,
      max_degree=3,
      estimator_list=None,
      estimator_param_list=None,
      numeric_features=None,
  ):
      """
      Finds the best estimator for regression function (g_s)
  
      :param cv: training and testing data indices obtained afteer Kfolding the dataset
      :param X: regressors data for training the regression model
      :param Y: outcome data for training the regression model
      :param max_degree: degree of the polynomial function used to approximate the regression function
      :param estimator_list: list of estimator objects for finding the regression function
      :param estimator_param_list: list of dictionaries with parameters for tuning respective estimators in estimator_list
      :param numeric_features: list of indices of numeric features in the dataset
  
      :returns: estimator for Reisz Regression function
      """
      if estimator_list is not None:
          estimator = GridSearchCVList(
              estimator_list,
              estimator_param_list,
              cv=cv,
              scoring="neg_mean_squared_error",
              n_jobs=-1,
          ).fit(X, Y)
          return estimator.best_estimator_
      else:
          estimator = GridSearchCVList(
              [
                  RandomForestRegressor(
                      n_estimators=100, random_state=120
                  ),
                  Pipeline(
                      [
                          (
                              "scale",
                              ColumnTransformer(
                                  [
                                      (
                                          "num",
                                          StandardScaler(),
                                          numeric_features,
                                      )
                                  ],
                                  remainder="passthrough",
                              ),
                          ),
                          ("lasso_model", Lasso()),
                      ]
                  ),
                  GradientBoostingRegressor(),
              ],
              param_grid_list=[
                  {
                      "n_estimators": [50],
                      "max_depth": [3, 4, 5],
                      "min_samples_leaf": [10, 50],
                  },
                  {
                      "lasso_model__alpha": [
                          0.01,
                          0.001,
                          1e-4,
                          1e-5,
                          1e-6,
                      ]
                  },
                  {
                      "learning_rate": [0.01, 0.001],
                      "n_estimators": [50, 200],
                  },
              ],
              cv=cv,
              scoring="neg_mean_squared_error",
              n_jobs=-1,
          ).fit(X, Y)
          return estimator.best_estimator_
  
imports: import numpy
  from econml.grf._base_grf import BaseGRF
  from econml.sklearn_extensions.model_selection import GridSearchCVList
  from econml.utilities import cross_product
  from sklearn.compose import ColumnTransformer
  from sklearn.ensemble import GradientBoostingClassifier, GradientBoostingRegressor, RandomForestClassifier, RandomForestRegressor
  from sklearn.linear_model import Lasso, LogisticRegression
  from sklearn.pipeline import Pipeline
  from sklearn.preprocessing import StandardScaler
  from dowhy.utils.regression import create_polynomial_function, generate_moment_function
label_desc: Use image node_id 3 for calling a global function with example usage: get_generic_regressor(cv, X, Y, max_degree, estimator_list, estimator_param_list, numeric_features) and returns: estimator, estimator