code: def encode_datetime(o):
      
      r = o.isoformat()
      if o.microsecond:
          r = r[:23] + r[26:]
      if r.endswith('+00:00'):
          r = r[:-6] + 'Z'
      return r
docs: Encodes a Python datetime.datetime object as an ECMA-262 compliant
      datetime string.