code: def pytz_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"``.
  
      Note: Since this function is slow, a faster version is available:
      `~greykite.common.features.timeseries_features.is_dst_fcn`.
      However, we expect the current function would be more accurate assuming
      the package `pytz` keeps up to date with potential changes in DST.
  
  
      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.
      """
      timezone = pytz.timezone(time_zone)
  
      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.
  
          """
          diff = []
          for dt0 in dt:
              timezone_date = timezone.localize(dt0, is_dst=False)
              diff.append(timezone_date.tzinfo._dst.seconds)
          return list(pd.Series(diff) != 0)
  
      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 3 for calling a global function with example usage: pytz_is_dst_fcn(time_zone) and returns: is_dst, list