code: def check_select_fit_kwargs(
      regressor: object, fit_kwargs: Optional[dict] = None
  ) -> dict:
      """
      Check if `fit_kwargs` is a dict and select only the keys that are used by
      the `fit` method of the regressor.
  
      Parameters
      ----------
      regressor : object
          Regressor object.
      fit_kwargs : dict, default `None`
          Dictionary with the arguments to pass to the `fit' method of the forecaster.
  
      Returns
      -------
      fit_kwargs : dict
          Dictionary with the arguments to be passed to the `fit` method of the
          regressor after removing the unused keys.
  
      """
  
      if fit_kwargs is None:
          fit_kwargs = {}
      else:
          if not isinstance(fit_kwargs, dict):
              raise TypeError(
                  f"Argument `fit_kwargs` must be a dict. Got {type(fit_kwargs)}."
              )
  
          # Non used keys
          non_used_keys = [
              k
              for k in fit_kwargs.keys()
              if k not in inspect.signature(regressor.fit).parameters
          ]
          if non_used_keys:
              warnings.warn(
                  (
                      f"Argument/s {non_used_keys} ignored since they are not used by the "
                      f"regressor's `fit` method."
                  ),
                  IgnoredArgumentWarning,
              )
  
          if "sample_weight" in fit_kwargs.keys():
              warnings.warn(
                  (
                      "The `sample_weight` argument is ignored. Use `weight_func` to pass "
                      "a function that defines the individual weights for each sample "
                      "based on its index."
                  ),
                  IgnoredArgumentWarning,
              )
              del fit_kwargs["sample_weight"]
  
          # Select only the keyword arguments allowed by the regressor's `fit` method.
          fit_kwargs = {
              k: v
              for k, v in fit_kwargs.items()
              if k in inspect.signature(regressor.fit).parameters
          }
  
      return fit_kwargs
  
imports: from typing import Union, Any, Optional, Tuple, Callable
  import warnings
  import importlib
  import joblib
  import numpy
  import pandas
  import sklearn
  import sklearn.pipeline
  import sklearn.linear_model
  from sklearn.compose import ColumnTransformer
  from sklearn.exceptions import NotFittedError
  import inspect
  from copy import deepcopy
  import skforecast
  from ..exceptions import MissingValuesExogWarning
  from ..exceptions import DataTypeWarning
  from ..exceptions import IgnoredArgumentWarning
  from ..exceptions import SkforecastVersionWarning
label_desc: Use image node_id 4 for calling a global function with example usage: check_select_fit_kwargs(regressor, fit_kwargs) and returns: fit_kwargs