code: def check_regressor(regressor=None, random_state=None):
      """Check if a valid regressor is given, otherwise set default regressor.
  
      Parameters
      ----------
      regressor : sklearn-like regressor, optional, default=None.
      random_state : int, RandomState instance or None, default=None
          Used to set random_state of the default regressor.
  
      Returns
      -------
      regressor
  
      Raises
      ------
      ValueError
          Raise error if given regressor is not a valid sklearn-like regressor.
      """
      if regressor is None:
          regressor = GradientBoostingRegressor(
              max_depth=5, random_state=random_state
          )
      else:
          if not is_regressor(regressor):
              raise ValueError(
                  f"`regressor` should be a sklearn-like regressor, "
                  f"but found: {regressor}"
              )
          regressor = clone(regressor)
      return regressor
  
file_path: sktime/sktime/utils/validation/forecasting.py
imports: from datetime import timedelta
  from typing import Optional, Union
  import numpy
  import pandas
  from sklearn.base import clone, is_regressor
  from sklearn.ensemble import GradientBoostingRegressor
  from sktime.utils.validation import array_is_datetime64, array_is_int, is_date_offset, is_int, is_timedelta
  from sktime.utils.validation.series import check_equal_time_index, check_series
label_desc: Use image node_id 11 for calling a global function with example usage: check_regressor(regressor, random_state) and returns: regressor