def time_to_json(pyt, manager):
    """Serialize a Python time object to json."""
    if pyt is None:
        return None
    else:
        return dict(
            hours=pyt.hour,  # Hours, Minutes, Seconds and Milliseconds
            minutes=pyt.minute,  # are plural in JS
            seconds=pyt.second,
            milliseconds=pyt.microsecond / 1000,
        )