def hydrate_time(nanoseconds, tz=None):
    """ Hydrator for `Time` and `LocalTime` values.

    :param nanoseconds:
    :param tz:
    :return: Time
    """
    seconds, nanoseconds = map(int, divmod(nanoseconds, 1000000000))
    minutes, seconds = map(int, divmod(seconds, 60))
    hours, minutes = map(int, divmod(minutes, 60))
    seconds = (1000000000 * seconds + nanoseconds) / 1000000000
    t = Time(hours, minutes, seconds)
    if tz is None:
        return t
    tz_offset_minutes, tz_offset_seconds = divmod(tz, 60)
    zone = FixedOffset(tz_offset_minutes)
    return zone.localize(t)
def hydrate_time ( nanoseconds , tz = None ) : seconds , nanoseconds = map ( int , divmod ( nanoseconds , 1000000000 ) ) minutes , seconds = map ( int , divmod ( seconds , 60 ) ) hours , minutes = map ( int , divmod ( minutes , 60 ) ) seconds = ( 1000000000 * seconds + nanoseconds ) / 1000000000 t = Time ( hours , minutes , seconds ) if tz is None : return t tz_offset_minutes , tz_offset_seconds = divmod ( tz , 60 ) zone = FixedOffset ( tz_offset_minutes ) return zone . localize ( t )
Hydrator for `Time` and `LocalTime` values.

    :param nanoseconds:
    :param tz:
    :return: Time