code: def test_get_hyperparameter_grid(df, forecast_config):
      template = MultistageForecastTemplate()
  
      # Error when `self.config` is not available.
      with pytest.raises(
          ValueError, match="Forecast config must be provided"
      ):
          template.get_hyperparameter_grid()
  
      template.df = df
      # Adds a list of length 2 to each submodel.
      # The result hyperparameter grid should have 2 * 2 = 4 grids.
      forecast_config.model_components_param.custom[
          "multistage_forecast_configs"
      ][0].model_components.seasonality["weekly_seasonality"] = [1, 2]
      forecast_config.model_components_param.custom[
          "multistage_forecast_configs"
      ][1].model_components.seasonality["daily_seasonality"] = [10, 12]
      template.config = forecast_config
      hyperparameter_grid = template.get_hyperparameter_grid()
      assert hyperparameter_grid["estimator__forecast_horizon"] == [12]
      assert hyperparameter_grid["estimator__freq"] == ["H"]
      assert len(hyperparameter_grid["estimator__model_configs"]) == 4
      assert (
          hyperparameter_grid["estimator__model_configs"][0][
              0
          ].estimator_params["weekly_seasonality"]
          == 1
      )
      assert (
          hyperparameter_grid["estimator__model_configs"][0][
              1
          ].estimator_params["daily_seasonality"]
          == 10
      )
      assert (
          hyperparameter_grid["estimator__model_configs"][1][
              0
          ].estimator_params["weekly_seasonality"]
          == 1
      )
      assert (
          hyperparameter_grid["estimator__model_configs"][1][
              1
          ].estimator_params["daily_seasonality"]
          == 12
      )
      assert (
          hyperparameter_grid["estimator__model_configs"][2][
              0
          ].estimator_params["weekly_seasonality"]
          == 2
      )
      assert (
          hyperparameter_grid["estimator__model_configs"][2][
              1
          ].estimator_params["daily_seasonality"]
          == 10
      )
      assert (
          hyperparameter_grid["estimator__model_configs"][3][
              0
          ].estimator_params["weekly_seasonality"]
          == 2
      )
      assert (
          hyperparameter_grid["estimator__model_configs"][3][
              1
          ].estimator_params["daily_seasonality"]
          == 12
      )
  
imports: import datetime
  import numpy
  import pytest
  from testfixtures import LogCapture
  from greykite.common.constants import LOGGER_NAME
  from greykite.common.constants import PREDICTED_COL
  from greykite.common.constants import PREDICTED_LOWER_COL
  from greykite.common.constants import PREDICTED_UPPER_COL
  from greykite.common.constants import TIME_COL
  from greykite.common.constants import VALUE_COL
  from greykite.common.testing_utils import generate_df_for_tests
  from greykite.framework.templates.autogen.forecast_config import EvaluationPeriodParam
  from greykite.framework.templates.autogen.forecast_config import ForecastConfig
  from greykite.framework.templates.autogen.forecast_config import MetadataParam
  from greykite.framework.templates.autogen.forecast_config import ModelComponentsParam
  from greykite.framework.templates.forecaster import Forecaster
  from greykite.framework.templates.multistage_forecast_template import MultistageForecastTemplate
  from greykite.framework.templates.multistage_forecast_template_config import SILVERKITE_TWO_STAGE
  from greykite.framework.templates.multistage_forecast_template_config import MultistageForecastTemplateConfig
  from greykite.framework.templates.simple_silverkite_template import SimpleSilverkiteTemplate
  from greykite.sklearn.estimator.simple_silverkite_estimator import SimpleSilverkiteEstimator
  from greykite.sklearn.uncertainty.uncertainty_methods import UncertaintyMethodEnum
label_desc: Use image node_id 7 for calling a global function with example usage: test_get_hyperparameter_grid(df, forecast_config) without return types