async def variant(self, elem=None, elem_type=None, params=None):
elem_type = elem_type if elem_type else elem.__class__<EOL>if hasattr(elem_type, '<STR_LIT>'):<EOL><INDENT>elem = elem_type() if elem is None else elem<EOL>return await elem.bob_serialize(self, elem=elem, elem_type=elem_type, params=params)<EOL><DEDENT>if self.writing:<EOL><INDENT>return await self.dump_variant(elem=elem,<EOL>elem_type=elem_type if elem_type else elem.__class__, params=params)<EOL><DEDENT>else:<EOL><INDENT>return await self.load_variant(elem_type=elem_type if elem_type else elem.__class__,<EOL>params=params, elem=elem)<EOL><DEDENT>
Loads/dumps variant type
:param elem:
:param elem_type:
:param params:
:param obj:
:return: