code: def test_ValueError_bayesian_search_forecaster_multiseries_when_return_best_and_len_series_exog_different():
      """
      Test ValueError is raised in bayesian_search_forecaster_multiseries when
      return_best and length of `series` and `exog` do not match.
      """
      forecaster = ForecasterAutoregMultiSeries(
          regressor=Ridge(random_state=123), lags=2
      )
      exog = series[:30].copy()
  
      def search_space(trial):  # pragma: no cover
          search_space = {
              "alpha": trial.suggest_float("alpha", 1e-2, 1.0)
          }
  
          return search_space
  
      err_msg = re.escape(
          (
              f"`exog` must have same number of samples as `series`. "
              f"length `exog`: ({len(exog)}), length `series`: ({len(series)})"
          )
      )
      with pytest.raises(ValueError, match=err_msg):
          bayesian_search_forecaster_multiseries(
              forecaster=forecaster,
              series=series,
              exog=exog,
              lags_grid=[2, 4],
              search_space=search_space,
              steps=3,
              metric="mean_absolute_error",
              refit=True,
              initial_train_size=len(series[:-12]),
              fixed_train_size=True,
              n_trials=10,
              random_state=123,
              return_best=True,
              verbose=False,
              engine="optuna",
          )
  
file_path: skforecast/skforecast/model_selection_multiseries/tests/test_bayesian_search_forecaster_multiseries.py
imports: import re
  import pytest
  import numpy
  import pandas
  from sklearn.linear_model import Ridge
  from skforecast.ForecasterAutoregMultiSeries import ForecasterAutoregMultiSeries
  from skforecast.ForecasterAutoregMultiSeriesCustom import ForecasterAutoregMultiSeriesCustom
  from skforecast.ForecasterAutoregMultiVariate import ForecasterAutoregMultiVariate
  from skforecast.model_selection_multiseries import bayesian_search_forecaster_multiseries
  from skforecast.model_selection_multiseries import bayesian_search_forecaster_multivariate
  from .fixtures_model_selection_multiseries import series
label_desc: Use image node_id 2 for calling a global function with example usage: test_ValueError_bayesian_search_forecaster_multiseries_when_return_best_and_len_series_exog_different() and returns: search_space