code: def test_TypeError_initialize_lags__rid_when_not_list_dict_or_None():
      """
      Test TypeError is raised when lags_grid is not a list, dict or None.
      """
      forecaster = ForecasterAutoreg(
          regressor=Ridge(random_state=123), lags=2
      )
      lags_grid = "not_valid_type"
  
      err_msg = re.escape(
          (
              f"`lags_grid` argument must be a list, dict or None. "
              f"Got {type(lags_grid)}."
          )
      )
      with pytest.raises(TypeError, match=err_msg):
          initialize_lags_grid(forecaster, lags_grid)
  
file_path: skforecast/skforecast/utils/tests/test_initialize_lags_grid.py
imports: import re
  import pytest
  import numpy
  import pandas
  from sklearn.linear_model import Ridge
  from skforecast.ForecasterAutoreg import ForecasterAutoreg
  from skforecast.ForecasterAutoregCustom import ForecasterAutoregCustom
  from skforecast.ForecasterAutoregMultiSeriesCustom import ForecasterAutoregMultiSeriesCustom
  from skforecast.utils import initialize_lags_grid
  from skforecast.exceptions import IgnoredArgumentWarning
label_desc: Use image node_id 2 for calling a global function with example usage: test_TypeError_initialize_lags__rid_when_not_list_dict_or_None() without return types