code: def config_events_to_model_dims(
      config_events: Optional[ConfigEvents], config_country_holidays
  ):
      """
      Convert user specified events configurations along with country specific
          holidays to input dims for TimeNet model.
  
      Parameters
      ----------
          config_events : configure.ConfigEvents
              Configurations (upper, lower windows, regularization) for user specified events
          config_country_holidays : configure.ConfigCountryHolidays
              Configurations (holiday_names, upper, lower windows, regularization) for country specific holidays
  
      Returns
      -------
          OrderedDict
              input dims for TimeNet model
  
              Note
              ----
  
              This dictionaries' keys correspond to individual holidays and contains configs such as the mode,
              list of event delims of the event corresponding to the offsets and
              indices in the input dataframe corresponding to each event.
      """
      if config_events is None and config_country_holidays is None:
          return None
      additive_events_dims = pd.DataFrame(
          columns=["event", "event_delim"]
      )
      multiplicative_events_dims = pd.DataFrame(
          columns=["event", "event_delim"]
      )
  
      if config_events is not None:
          for event, configs in config_events.items():
              mode = configs.mode
              for offset in range(
                  configs.lower_window, configs.upper_window + 1
              ):
                  event_delim = create_event_names_for_offsets(
                      event, offset
                  )
                  if mode == "additive":
                      additive_events_dims = pd.concat(
                          [
                              additive_events_dims,
                              pd.DataFrame(
                                  [
                                      {
                                          "event": event,
                                          "event_delim": event_delim,
                                      }
                                  ]
                              ),
                          ],
                          ignore_index=True,
                      )
                  else:
                      multiplicative_events_dims = pd.concat(
                          [
                              multiplicative_events_dims,
                              pd.DataFrame(
                                  [
                                      {
                                          "event": event,
                                          "event_delim": event_delim,
                                      }
                                  ]
                              ),
                          ],
                          ignore_index=True,
                      )
  
      if config_country_holidays is not None:
          lower_window = config_country_holidays.lower_window
          upper_window = config_country_holidays.upper_window
          mode = config_country_holidays.mode
          for country_holiday in config_country_holidays.holiday_names:
              for offset in range(lower_window, upper_window + 1):
                  holiday_delim = create_event_names_for_offsets(
                      country_holiday, offset
                  )
                  if mode == "additive":
                      additive_events_dims = pd.concat(
                          [
                              additive_events_dims,
                              pd.DataFrame(
                                  [
                                      {
                                          "event": country_holiday,
                                          "event_delim": holiday_delim,
                                      }
                                  ]
                              ),
                          ],
                          ignore_index=True,
                      )
                  else:
                      multiplicative_events_dims = pd.concat(
                          [
                              multiplicative_events_dims,
                              pd.DataFrame(
                                  [
                                      {
                                          "event": country_holiday,
                                          "event_delim": holiday_delim,
                                      }
                                  ]
                              ),
                          ],
                          ignore_index=True,
                      )
  
      # sort based on event_delim
      event_dims = pd.DataFrame()
      if not additive_events_dims.empty:
          additive_events_dims = additive_events_dims.sort_values(
              by="event_delim"
          ).reset_index(drop=True)
          additive_events_dims["mode"] = "additive"
          event_dims = additive_events_dims
  
      if not multiplicative_events_dims.empty:
          multiplicative_events_dims = (
              multiplicative_events_dims.sort_values(
                  by="event_delim"
              ).reset_index(drop=True)
          )
          multiplicative_events_dims["mode"] = "multiplicative"
          event_dims = pd.concat(
              [event_dims, multiplicative_events_dims]
          )
  
      event_dims_dic = OrderedDict({})
      # convert to dict format
      for event, row in event_dims.groupby("event"):
          event_dims_dic[event] = {
              "mode": row["mode"].iloc[0],
              "event_delim": list(row["event_delim"]),
              "event_indices": list(row.index),
          }
      return event_dims_dic
  
imports: from __future__ import annotations
  import logging
  import math
  import os
  import sys
  from collections import OrderedDict
  from typing import TYPE_CHECKING, Iterable, Optional, Union
  import numpy
  import pandas
  import pytorch_lightning
  import torch
  from neuralprophet import utils_torch
  from neuralprophet.hdays_utils import get_country_holidays
  from neuralprophet.logger import ProgressBar
label_desc: Use image node_id 14 for calling a global function with example usage: config_events_to_model_dims(config_events, config_country_holidays) and returns: event_dims_dic, None