Loads/dumps message
        :param msg:
        :param msg_type:
        :param obj:
        :return:

async def message(self, msg, msg_type=None, obj=None):
        """
        Loads/dumps message
        :param msg:
        :param msg_type:
        :param obj:
        :return:
        """
        elem_type = msg_type if msg_type is not None else msg.__class__
        obj = collections.OrderedDict() if not x.has_elem(obj) else x.get_elem(obj)

        if hasattr(elem_type, 'kv_serialize'):
            msg = elem_type() if msg is None else msg
            return await msg.kv_serialize(self, obj=obj)

        fields = elem_type.f_specs()
        for field in fields:
            await self.message_field(msg=msg, field=field, obj=obj)

        return obj if self.writing else msg