def hydrate_datetime(seconds, nanoseconds, tz=None):
minutes, seconds = map(int, divmod(seconds, <NUM_LIT>))<EOL>hours, minutes = map(int, divmod(minutes, <NUM_LIT>))<EOL>days, hours = map(int, divmod(hours, <NUM_LIT>))<EOL>seconds = (<NUM_LIT> * seconds + nanoseconds) / <NUM_LIT><EOL>t = DateTime.combine(Date.from_ordinal(UNIX_EPOCH_DATE_ORDINAL + days), Time(hours, minutes, seconds))<EOL>if tz is None:<EOL><INDENT>return t<EOL><DEDENT>if isinstance(tz, int):<EOL><INDENT>tz_offset_minutes, tz_offset_seconds = divmod(tz, <NUM_LIT>)<EOL>zone = FixedOffset(tz_offset_minutes)<EOL><DEDENT>else:<EOL><INDENT>zone = timezone(tz)<EOL><DEDENT>return zone.localize(t)<EOL>
Hydrator for `DateTime` and `LocalDateTime` values.

    :param seconds:
    :param nanoseconds:
    :param tz:
    :return: datetime