code: def _encode_datetime(obj):
      
  
      if isinstance(obj, datetime.datetime):
          obj = {'__datetime__': True, 'as_str': obj.strftime("%Y%m%dT%H:%M:%S.%f").encode()}
      return obj
docs: Encode a msgpck'ed datetime.