def encode_datetime(obj):
<EOL>zone = '<STR_LIT>' if getattr(obj, '<STR_LIT>', True) else '<STR_LIT>'<EOL>return obj.isoformat() + zone<EOL>
Encode a datetime.datetime or datetime.date object as an ISO 8601 format string.