docstr: Based on the type of the argument and the nature of the covariates, perform some sanity checks before
  converting the lags to a list of integer.
  
  If lags are provided as a dictionary, the lags values are contained in self.component_lags and the self.lags
  attributes contain only the extreme values
  If the lags are provided as integer, list, tuple or dictionary containing only the 'default_lags' keys, the lags
  values are contained in the self.lags attribute and the self.component_lags is an empty dictionary.
docstr_tok: ["Based","on","the","type","of","the","argument","and","the","nature","of","the","covariates",",","perform","some","sanity","checks","before","converting","the","lags","to","a","list","of","integer",".","If","lags","are","provided","as","a","dictionary",",","the","lags","values","are","contained","in","self.component_lags","and","the","self.lags","attributes","contain","only","the","extreme","values","If","the","lags","are","provided","as","integer",",","list",",","tuple","or","dictionary","containing","only","the","'default_lags","'","keys",",","the","lags","values","are","contained","in","the","self.lags","attribute","and","the","self.component_lags","is","an","empty","dictionary","."]
code: def _generate_lags(
      self,
      lags: Optional[LAGS_TYPE],
      lags_past_covariates: Optional[LAGS_TYPE],
      lags_future_covariates: Optional[FUTURE_LAGS_TYPE],
  ) -> Tuple[Dict[str, List[int]], Dict[str, Dict[str, List[int]]]]:
      """
      Based on the type of the argument and the nature of the covariates, perform some sanity checks before
      converting the lags to a list of integer.
  
      If lags are provided as a dictionary, the lags values are contained in self.component_lags and the self.lags
      attributes contain only the extreme values
      If the lags are provided as integer, list, tuple or dictionary containing only the 'default_lags' keys, the lags
      values are contained in the self.lags attribute and the self.component_lags is an empty dictionary.
      """
      processed_lags: Dict[str, List[int]] = dict()
      processed_component_lags: Dict[str, Dict[str, List[int]]] = dict()
      for lags_values, lags_name, lags_abbrev in zip(
          [lags, lags_past_covariates, lags_future_covariates],
          ["lags", "lags_past_covariates", "lags_future_covariates"],
          ["target", "past", "future"],
      ):
          if lags_values is None:
              continue
  
          # converting to dictionary to run sanity checks
          if not isinstance(lags_values, dict):
              lags_values = {"default_lags": lags_values}
          elif len(lags_values) == 0:
              raise_log(
                  ValueError(
                      f"When passed as a dictionary, `{lags_name}` must contain at least one key."
                  ),
                  logger,
              )
  
          invalid_type = False
          supported_types = ""
          min_lags = None
          max_lags = None
          tmp_components_lags: Dict[str, List[int]] = dict()
          for comp_name, comp_lags in lags_values.items():
              if lags_name == "lags_future_covariates":
                  if isinstance(comp_lags, tuple):
                      raise_if_not(
                          len(comp_lags) == 2
                          and isinstance(comp_lags[0], int)
                          and isinstance(comp_lags[1], int),
                          f"`{lags_name}` - `{comp_name}`: tuple must be of length 2, and must contain two integers",
                          logger,
                      )
  
                      raise_if(
                          isinstance(comp_lags[0], bool)
                          or isinstance(comp_lags[1], bool),
                          f"`{lags_name}` - `{comp_name}`: tuple must contain integers, not bool",
                          logger,
                      )
  
                      raise_if_not(
                          comp_lags[0] >= 0 and comp_lags[1] >= 0,
                          f"`{lags_name}` - `{comp_name}`: tuple must contain positive integers. Given: {comp_lags}.",
                          logger,
                      )
                      raise_if(
                          comp_lags[0] == 0 and comp_lags[1] == 0,
                          f"`{lags_name}` - `{comp_name}`: tuple cannot be (0, 0) as it corresponds to an empty "
                          f"list of lags.",
                          logger,
                      )
                      tmp_components_lags[comp_name] = list(
                          range(-comp_lags[0], comp_lags[1])
                      )
                  elif isinstance(comp_lags, list):
                      for lag in comp_lags:
                          raise_if(
                              not isinstance(lag, int)
                              or isinstance(lag, bool),
                              f"`{lags_name}` - `{comp_name}`: list must contain only integers. Given: {comp_lags}.",
                              logger,
                          )
                      tmp_components_lags[comp_name] = sorted(comp_lags)
                  else:
                      invalid_type = True
                      supported_types = "tuple or a list"
              else:
                  if isinstance(comp_lags, int):
                      raise_if_not(
                          comp_lags > 0,
                          f"`{lags_name}` - `{comp_name}`: integer must be strictly positive . Given: {comp_lags}.",
                          logger,
                      )
                      tmp_components_lags[comp_name] = list(
                          range(-comp_lags, 0)
                      )
                  elif isinstance(comp_lags, list):
                      for lag in comp_lags:
                          raise_if(
                              not isinstance(lag, int) or (lag >= 0),
                              f"`{lags_name}` - `{comp_name}`: list must contain only strictly negative integers. "
                              f"Given: {comp_lags}.",
                              logger,
                          )
                      tmp_components_lags[comp_name] = sorted(comp_lags)
                  else:
                      invalid_type = True
                      supported_types = (
                          "strictly positive integer or a list"
                      )
  
              if invalid_type:
                  raise_log(
                      ValueError(
                          f"`{lags_name}` - `{comp_name}`: must be either a {supported_types}. "
                          f"Gived : {type(comp_lags)}."
                      ),
                      logger,
                  )
  
              # extracting min and max lags va
              if min_lags is None:
                  min_lags = tmp_components_lags[comp_name][0]
              else:
                  min_lags = min(
                      min_lags, tmp_components_lags[comp_name][0]
                  )
  
              if max_lags is None:
                  max_lags = tmp_components_lags[comp_name][-1]
              else:
                  max_lags = max(
                      max_lags, tmp_components_lags[comp_name][-1]
                  )
  
          # revert to shared lags logic when applicable
          if list(tmp_components_lags.keys()) == ["default_lags"]:
              processed_lags[lags_abbrev] = tmp_components_lags[
                  "default_lags"
              ]
          else:
              processed_lags[lags_abbrev] = [min_lags, max_lags]
              processed_component_lags[
                  lags_abbrev
              ] = tmp_components_lags
  
      return processed_lags, processed_component_lags
  
imports: from collections import OrderedDict
  from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
  import numpy
  import pandas
  from sklearn.linear_model import LinearRegression
  from darts.logging import get_logger, raise_if, raise_if_not, raise_log
  from darts.models.forecasting.forecasting_model import GlobalForecastingModel
  from darts.timeseries import TimeSeries
  from darts.utils.data.tabularization import add_static_covariates_to_lagged_data, create_lagged_component_names, create_lagged_training_data
  from darts.utils.historical_forecasts import _check_optimizable_historical_forecasts_global_models, _optimized_historical_forecasts_all_points, _optimized_historical_forecasts_last_points_only, _process_historical_forecast_input
  from darts.utils.multioutput import MultiOutputRegressor
  from darts.utils.utils import _check_quantiles, get_single_series, seq2series, series2seq
label_desc: Use image node_id 2 for calling the RegressionModel obj's underlying member method code with example usage: obj._generate_lags(lags, lags_past_covariates, lags_future_covariates) and returns: processed_lags,  processed_component_lags