async def message(self, msg, msg_type=None, use_version=None):
elem_type = msg_type if msg_type is not None else msg.__class__<EOL>msg = elem_type() if msg is None else msg<EOL>if hasattr(elem_type, "<STR_LIT>"):<EOL><INDENT>version = await self.version(elem_type, None, elem=msg) if use_version is None else use_version<EOL>return await msg.serialize_archive(self, version=version)<EOL><DEDENT>mtype = msg.__class__ if msg_type is None else msg_type<EOL>fields = mtype.f_specs()<EOL>if hasattr(mtype, "<STR_LIT>"):<EOL><INDENT>raise ValueError("<STR_LIT>" % mtype)<EOL><DEDENT>await self.message_fields(msg, fields)<EOL>return msg<EOL>
Loads/dumps message
:param msg:
:param msg_type:
:param use_version:
:return: