code: 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,
          )
  
imports: import re
  import traitlets
  import datetime
label_desc: Use image node_id 7 for calling a global function with example usage: time_to_json(pyt, manager) and returns: None, dict