code: def get_us_dst_end(year):
      """For each year, it returns the first Sunday in November,
      which is the end of the daylight saving (DST) in US/Canada.
  
      We assume DST ends on Second Sunday of Novemeber at 2 a.m.
  
      Parameters
      ----------
      year : `int`
          Year for which DST end date is desired.
  
      Returns
      -------
      result : `datetime.datetime`
          The timestamp of end of DST in US/Canada.
      """
      # Finds the first date in the second week.
      date_in_2nd_week = datetime(year, 11, 8, 2)
      # Finds out which week day it is:
      weekday = date_in_2nd_week.weekday()
      # Goes back to Monday of the second week and does an extra -1.
      first_sunday_date = date_in_2nd_week.replace(
          day=(8 - weekday - 1)
      )
      return first_sunday_date
  
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 5 for calling a global function with example usage: get_us_dst_end(year) and returns: first_sunday_date