def IsPacificDST(now):
  """Helper for PacificTime to decide whether now is Pacific DST (PDT).

  Args:
    now: A pseudo-posix timestamp giving current time in PST.

  Returns:
    True if now falls within the range of DST, False otherwise.
  """
  DAY = 24*3600
  SUNDAY = 6
  pst = time.gmtime(now)
  year = pst[0]
  assert year >= 2007
  begin = calendar.timegm((year, 3, 8, 2, 0, 0, 0, 0, 0))
  while time.gmtime(begin).tm_wday != SUNDAY:
    begin += DAY
  end = calendar.timegm((year, 11, 1, 2, 0, 0, 0, 0, 0))
  while time.gmtime(end).tm_wday != SUNDAY:
    end += DAY
  return begin <= now < end
dataset/ETHPy150Open CollabQ/CollabQ/.google_appengine/google/appengine/tools/appcfg.py/IsPacificDST/original