code: def date_to_json(pydate, manager):
      """Serialize a Python date object.
  
      Attributes of this dictionary are to be passed to the JavaScript Date
      constructor.
      """
      if pydate is None:
          return None
      else:
          return dict(
              year=pydate.year,
              month=pydate.month
              - 1,  # Months are 0-based indices in JS
              date=pydate.day,
          )
  
imports: import re
  import traitlets
  import datetime
label_desc: Use image node_id 5 for calling a global function with example usage: date_to_json(pydate, manager) and returns: None, dict