code: def test_bagging_forecaster_forecaster_type_error(forecaster):
      """Test that the right exception is raised for invalid forecaster."""
      y = load_airline()
  
      with pytest.raises(TypeError) as ex:
          f = BaggingForecaster(
              bootstrap_transformer=STLBootstrapTransformer(sp=12),
              forecaster=forecaster,
          )
          f.fit(y)
          msg = "forecaster in BaggingForecaster should be an sktime Forecaster"
          assert msg == ex.value
  
file_path: sktime/sktime/forecasting/compose/tests/test_bagging.py
imports: import pandas
  import pytest
  from sktime.datasets import load_airline
  from sktime.forecasting.compose import BaggingForecaster
  from sktime.forecasting.naive import NaiveForecaster
  from sktime.tests.test_switch import run_test_for_class
  from sktime.transformations.bootstrap import STLBootstrapTransformer
  from sktime.transformations.series.boxcox import LogTransformer
label_desc: Use image node_id 2 for calling a global function with example usage: test_bagging_forecaster_forecaster_type_error(forecaster) without return types