code: def to_json(self, value):
          
          if isinstance(value, datetime.datetime):
              return value.strftime(self.DATETIME_FORMAT)
          if value is None:
              return None
          raise TypeError("Value stored must be a datetime object, not {}".format(type(value)))
docs: Serialize the date as an ISO-formatted date string, or None.