code: def test_results_output_bayesian_search_optuna_multiseries_with_mocked_when_kwargs_create_study():
      """
      Test output of _bayesian_search_optuna_multiseries in ForecasterAutoregMultiSeries
      when `kwargs_create_study` with mocked (mocked done in skforecast v0.12.0).
      """
      forecaster = ForecasterAutoregMultiSeries(
          regressor=Ridge(random_state=123), lags=2
      )
  
      steps = 3
      n_validation = 12
      lags_grid = [2, 4]
  
      def search_space(trial):
          search_space = {
              "alpha": trial.suggest_float("alpha", 2e-2, 2.0)
          }
  
          return search_space
  
      # kwargs_create_study
      sampler = TPESampler(
          seed=123, prior_weight=2.0, consider_magic_clip=False
      )
  
      results = _bayesian_search_optuna_multiseries(
          forecaster=forecaster,
          series=series,
          steps=steps,
          lags_grid=lags_grid,
          search_space=search_space,
          metric="mean_absolute_error",
          refit=False,
          initial_train_size=len(series) - n_validation,
          n_trials=10,
          random_state=123,
          return_best=False,
          verbose=False,
          kwargs_create_study={"sampler": sampler},
      )[0]
  
      expected_results = pd.DataFrame(
          {
              "levels": [["l1", "l2"]] * 2 * 10,
              "lags": [
                  [1, 2, 3, 4],
                  [1, 2, 3, 4],
                  [1, 2, 3, 4],
                  [1, 2, 3, 4],
                  [1, 2, 3, 4],
                  [1, 2, 3, 4],
                  [1, 2, 3, 4],
                  [1, 2, 3, 4],
                  [1, 2, 3, 4],
                  [1, 2, 3, 4],
                  [1, 2],
                  [1, 2],
                  [1, 2],
                  [1, 2],
                  [1, 2],
                  [1, 2],
                  [1, 2],
                  [1, 2],
                  [1, 2],
                  [1, 2],
              ],
              "params": [
                  {"alpha": 0.4691658780571222},
                  {"alpha": 0.5865558832017513},
                  {"alpha": 0.796392686024418},
                  {"alpha": 0.8577507910464327},
                  {"alpha": 0.9722451649390347},
                  {"alpha": 1.1116032427841247},
                  {"alpha": 1.3759628823980292},
                  {"alpha": 1.3990089874837661},
                  {"alpha": 1.4445485601754149},
                  {"alpha": 1.9619131128015386},
                  {"alpha": 0.4691658780571222},
                  {"alpha": 0.5865558832017513},
                  {"alpha": 0.796392686024418},
                  {"alpha": 0.8577507910464327},
                  {"alpha": 0.9722451649390347},
                  {"alpha": 1.1116032427841247},
                  {"alpha": 1.3759628823980292},
                  {"alpha": 1.3990089874837661},
                  {"alpha": 1.4445485601754149},
                  {"alpha": 1.9619131128015386},
              ],
              "mean_absolute_error": np.array(
                  [
                      0.20881436,
                      0.20882016,
                      0.20883044,
                      0.20883343,
                      0.20883898,
                      0.2088457,
                      0.20885832,
                      0.20885942,
                      0.20886157,
                      0.20888574,
                      0.20913306,
                      0.20913613,
                      0.2091416,
                      0.2091432,
                      0.20914616,
                      0.20914976,
                      0.20915655,
                      0.20915714,
                      0.2091583,
                      0.20917142,
                  ]
              ),
              "alpha": np.array(
                  [
                      0.46916588,
                      0.58655588,
                      0.79639269,
                      0.85775079,
                      0.97224516,
                      1.11160324,
                      1.37596288,
                      1.39900899,
                      1.44454856,
                      1.96191311,
                      0.46916588,
                      0.58655588,
                      0.79639269,
                      0.85775079,
                      0.97224516,
                      1.11160324,
                      1.37596288,
                      1.39900899,
                      1.44454856,
                      1.96191311,
                  ]
              ),
          },
          index=pd.Index(
              [
                  12,
                  11,
                  19,
                  15,
                  18,
                  13,
                  17,
                  10,
                  14,
                  16,
                  2,
                  1,
                  9,
                  5,
                  8,
                  3,
                  7,
                  0,
                  4,
                  6,
              ],
              dtype="int64",
          ),
      )
  
      pd.testing.assert_frame_equal(results, expected_results)
  
imports: import re
  import pytest
  import numpy
  import pandas
  import sys
  from sklearn.ensemble import RandomForestRegressor
  from sklearn.linear_model import Ridge
  from sklearn.metrics import mean_absolute_error
  from skforecast.ForecasterAutoregMultiSeries import ForecasterAutoregMultiSeries
  from skforecast.ForecasterAutoregMultiSeriesCustom import ForecasterAutoregMultiSeriesCustom
  from skforecast.model_selection_multiseries import backtesting_forecaster_multiseries
  from skforecast.model_selection_multiseries.model_selection_multiseries import _bayesian_search_optuna_multiseries
  import optuna
  from optuna.samplers import TPESampler
  from tqdm import tqdm
  from functools import partialmethod
  from .fixtures_model_selection_multiseries import series
label_desc: Use image node_id 7 for calling a global function with example usage: test_results_output_bayesian_search_optuna_multiseries_with_mocked_when_kwargs_create_study() and returns: search_space