Convert a `datetime.date` or `datetime.datetime` to a `struct_time`
    representation *with zero values* for data fields that we cannot always
    rely on for ancient or far-future dates: tm_wday, tm_yday, tm_isdst

    NOTE: If it wasn't for the requirement that the extra fields are unset
    we could use the `timetuple()` method instead of this function.

def dt_to_struct_time(dt):
    """
    Convert a `datetime.date` or `datetime.datetime` to a `struct_time`
    representation *with zero values* for data fields that we cannot always
    rely on for ancient or far-future dates: tm_wday, tm_yday, tm_isdst

    NOTE: If it wasn't for the requirement that the extra fields are unset
    we could use the `timetuple()` method instead of this function.
    """
    if isinstance(dt, datetime):
        return struct_time(
            [dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second] +
            TIME_EMPTY_EXTRAS
        )
    elif isinstance(dt, date):
        return struct_time(
            [dt.year, dt.month, dt.day] + TIME_EMPTY_TIME + TIME_EMPTY_EXTRAS
        )
    else:
        raise NotImplementedError(
            "Cannot convert %s to `struct_time`" % type(dt))