code: def hydrate_datetime(seconds, nanoseconds, tz=None):
      
      minutes, seconds = map(int, divmod(seconds, 60))
      hours, minutes = map(int, divmod(minutes, 60))
      days, hours = map(int, divmod(hours, 24))
      seconds = (1000000000 * seconds + nanoseconds) / 1000000000
      t = DateTime.combine(Date.from_ordinal(UNIX_EPOCH_DATE_ORDINAL + days), Time(hours, minutes, seconds))
      if tz is None:
          return t
      if isinstance(tz, int):
          tz_offset_minutes, tz_offset_seconds = divmod(tz, 60)
          zone = FixedOffset(tz_offset_minutes)
      else:
          zone = timezone(tz)
      return zone.localize(t)
docs: Hydrator for `DateTime` and `LocalDateTime` values.
  
      :param seconds:
      :param nanoseconds:
      :param tz:
      :return: datetime