<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def datetime_to_json(pydt, manager):
 """Serialize a Python datetime object to json. Instantiating a JavaScript Date object with a string assumes that the string is a UTC string, while instantiating it with constructor arguments assumes that it's in local time: Mon May 11 2015 20:00:00 GMT-0400 (Eastern Daylight Time) Tue May 12 2015 00:00:00 GMT-0400 (Eastern Daylight Time) Attributes of this dictionary are to be passed to the JavaScript Date constructor. """

    if pydt is None:
        return None
    else:
        return dict(
            year=pydt.year,
            month=pydt.month - 1,  # Months are 0-based indices in JS
            date=pydt.day,
            hours=pydt.hour,       # Hours, Minutes, Seconds and Milliseconds
            minutes=pydt.minute,   # are plural in JS
            seconds=pydt.second,
            milliseconds=pydt.microsecond / 1000
        )