Loads/dumps variant type
        :param elem:
        :param elem_type:
        :param params:
        :param obj:
        :return:

async def variant(self, elem=None, elem_type=None, params=None, obj=None):
        """
        Loads/dumps variant type
        :param elem:
        :param elem_type:
        :param params:
        :param obj:
        :return:
        """
        elem_type = elem_type if elem_type else elem.__class__

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

        if self.writing:
            return await self.dump_variant(elem=elem,
                                           elem_type=elem_type if elem_type else elem.__class__, params=params, obj=obj)
        else:
            return await self.load_variant(elem_type=elem_type if elem_type else elem.__class__,
                                           params=params, elem=elem, obj=obj)