async def dump_variant(self, elem, elem_type=None, params=None):
if isinstance(elem, x.VariantType) or elem_type.WRAPS_VALUE:<EOL><INDENT>await dump_uvarint(self.iobj, elem.variant_elem_type.VARIANT_CODE)<EOL>await self._dump_field(getattr(elem, elem.variant_elem), elem.variant_elem_type)<EOL><DEDENT>else:<EOL><INDENT>fdef = elem_type.find_fdef(elem_type.f_specs(), elem)<EOL>vcode = fdef[<NUM_LIT:1>].BOOST_VARIANT_CODE if hasattr(fdef[<NUM_LIT:1>], '<STR_LIT>') else fdef[<NUM_LIT:1>].VARIANT_CODE<EOL>await dump_uvarint(self.iobj, vcode)<EOL>await self._dump_field(elem, fdef[<NUM_LIT:1>])<EOL><DEDENT>
Dumps variant type to the writer.
Supports both wrapped and raw variant.

:param writer:
:param elem:
:param elem_type:
:param params:
:return: