code: def reg_func_events(
      config_events: Optional[ConfigEvents],
      config_country_holidays,
      model,
  ):
      """
      Regularization of events coefficients to induce sparcity
  
      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
          model : TimeNet
              The TimeNet model object
  
      Returns
      -------
          scalar
              Regularization loss
      """
  
      reg_events_loss = 0.0
      if config_events is not None:
          for event, configs in config_events.items():
              reg_events_loss += _regularize_weights(
                  model.get_event_weights(event), configs.reg_lambda
              )
  
      if config_country_holidays is not None:
          for holiday in config_country_holidays.holiday_names:
              reg_events_loss += _regularize_weights(
                  model.get_event_weights(holiday),
                  config_country_holidays.reg_lambda,
              )
  
      return reg_events_loss
  
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 7 for calling a global function with example usage: reg_func_events(config_events, config_country_holidays, model) and returns: reg_events_loss