def _is_dst(dt):
        """
        Returns True if a given datetime object represents a time with
        DST shift.
        """
        # we can't use `dt.timestamp()` here since it requires a `utcoffset`
        # and we don't want to get into a recursive loop
        localtime = time.localtime(time.mktime((
            dt.year,
            dt.month,
            dt.day,
            dt.hour,
            dt.minute,
            dt.second,
            dt.weekday(),
            0,              # day of the year
            -1              # dst
        )))
        return localtime.tm_isdst > 0
Returns True if a given datetime object represents a time with
        DST shift.