code: def select_n_jobs_fit_forecaster(
      forecaster_name: str,
      regressor_name: str,
  ) -> int:
      """
      Select the optimal number of jobs to use in the fitting process. This
      selection is based on heuristics and is not guaranteed to be optimal.
  
      The number of jobs is chosen as follows:
  
      - If forecaster_name is 'ForecasterAutoregDirect' or 'ForecasterAutoregMultiVariate'
      and regressor_name is a linear regressor, then n_jobs=1, otherwise n_jobs=cpu_count().
  
      Parameters
      ----------
      forecaster_name : str
          The type of Forecaster.
      regressor_name : str
          The type of regressor.
  
      Returns
      -------
      n_jobs : int
          The number of jobs to run in parallel.
  
      """
  
      linear_regressors = [
          regressor_name
          for regressor_name in dir(sklearn.linear_model)
          if not regressor_name.startswith("_")
      ]
  
      if forecaster_name in [
          "ForecasterAutoregDirect",
          "ForecasterAutoregMultiVariate",
      ]:
          if regressor_name in linear_regressors:
              n_jobs = 1
          else:
              n_jobs = joblib.cpu_count()
      else:
          n_jobs = 1
  
      return n_jobs
  
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 27 for calling a global function with example usage: select_n_jobs_fit_forecaster(forecaster_name, regressor_name) and returns: n_jobs