code: def is_dst_fcn(time_zone):
      """For a given timezone, it constructs a function which determines
      if a timestamp (`dt`) is inside the daylight saving period or not for
      a list of timestamps.
  
      This function, should work for regions in US / Canada and Europe.
  
      The returned function assumes that the timestamps are in the given
      ``time_zone``.
      Note that since daylight saving is the same for all of mainland US / Canada,
      one can pass any US time zone e.g. ``"US/Pacific"`` to construct a function
      which works for all of mainland US.
      Similarly for most of Europe, it is suffcient to pass any Europe time zone e.g.
      ``"Europe/London"``.
  
      Some references on when did DST start in modern era:
  
      - Europe: https://www.timeanddate.com/time/europe/daylight-saving-history.html
      - US: https://en.wikipedia.org/wiki/Daylight_saving_time_in_the_United_States
  
      Note: This function assumes the DST rules remain the same as what they
      are in the year 2022 (when this code was written).
      A potentially more accurate (but much slower) version is available:
      `~greykite.common.features.timeseries_features.pytz_is_dst_fcn`.
      However, we expect the current function would be much faster and it can be
      updated in case DST rules change.
  
  
      Parameters
      ----------
      time_zone : `str`
          A string denoting the timestamp e.g. "US/Pacific", "Canada/Eastern",
          "Europe/London".
  
      Returns
      -------
      is_dst : callable
          A function which takes a list of datetime-like objects
          and returns a list of colleans to determine if each timestamp is in daylight saving.
      """
      if "US" in time_zone or "Canada" in time_zone:
          get_dst_start = get_us_dst_start
          get_dst_end = get_us_dst_end
      elif "Europe" in time_zone:
          get_dst_start = get_eu_dst_start
          get_dst_end = get_eu_dst_end
      else:
          raise ValueError(
              f"`time_zone` string {time_zone} does not include "
              "either of: 'US'/'Canada'/'Europe'"
          )
  
      # For US, the current convention seems to have started in 2007
      # See references in function docstring
      us_year_range = range(2007, 2080)
      us_starts = {year: get_dst_start(year) for year in us_year_range}
      us_ends = {year: get_dst_end(year) for year in us_year_range}
  
      # For Europe, the current convention seems to have started in 1996
      # See references in function docstring:
      # Quoting from the link: "In 1996, the European Union (EU) standardized the DST schedule"
      europe_year_range = range(1996, 2080)
      europe_starts = {
          year: get_dst_start(year) for year in europe_year_range
      }
      europe_ends = {
          year: get_dst_end(year) for year in europe_year_range
      }
  
      if "US" in time_zone or "Canada" in time_zone:
          year_range = us_year_range
          starts = us_starts
          ends = us_ends
      else:
          # Note that due to above if statements, we now that else maps to "Europe"
          # Otherwise a `ValueError` would have been raised.
          year_range = europe_year_range
          starts = europe_starts
          ends = europe_ends
  
      def is_dst(dt):
          """A function which takes a list of datetime-like objects
          and returns a list of booleans to determine if that timestamp
          is in daylight saving.
  
          Parameters
          ----------
          dt : `list` of datetime-like object
  
          Returns
          -------
          result : `list` [`bool`]
              A list of booleans:
  
              - If True, the input time is in daylight saving.
              - If False, the input time is NOT in daylight saving.
  
          """
          is_dst_bool = []
          for dt0 in dt:
              year = dt0.year
              if year in year_range:
                  start, end = starts[year], ends[year]
                  if dt0 >= start and dt0 <= end:
                      # This will be true at most for one year in the range
                      is_dst_bool.append(True)
                  else:
                      is_dst_bool.append(False)
              else:
                  # This is the rare case for which the timestamp is not within
                  # the range of all years considered in `year_range = range(1950, 2080)`
                  is_dst_bool.append(False)
  
          return is_dst_bool
  
      return is_dst
  
imports: import math
  from datetime import datetime
  from datetime import timedelta
  import numpy
  import pandas
  import pytz
  from holidays_ext import get_holidays
  from pandas.tseries.frequencies import to_offset
  from scipy.special import expit
  from greykite.common import constants
  from greykite.common.python_utils import split_offset_str
label_desc: Use image node_id 8 for calling a global function with example usage: is_dst_fcn(time_zone) and returns: is_dst, is_dst_bool