async def _load_variant(<EOL>self, reader, elem_type, params=None, elem=None, wrapped=None<EOL>):
is_wrapped = (<EOL>(isinstance(elem, VariantType) or elem_type.WRAPS_VALUE)<EOL>if wrapped is None<EOL>else wrapped<EOL>)<EOL>if is_wrapped:<EOL><INDENT>elem = elem_type() if elem is None else elem<EOL><DEDENT>tag = await load_uint(reader, <NUM_LIT:1>)<EOL>for field in elem_type.f_specs():<EOL><INDENT>ftype = field[<NUM_LIT:1>]<EOL>if ftype.VARIANT_CODE == tag:<EOL><INDENT>fvalue = await self.load_field(<EOL>reader, ftype, field[<NUM_LIT:2>:], elem if not is_wrapped else None<EOL>)<EOL>if is_wrapped:<EOL><INDENT>elem.set_variant(field[<NUM_LIT:0>], fvalue)<EOL><DEDENT>return elem if is_wrapped else fvalue<EOL><DEDENT><DEDENT>raise ValueError("<STR_LIT>" % tag)<EOL>
Loads variant type from the reader.
Supports both wrapped and raw variant.

:param reader:
:param elem_type:
:param params:
:param elem:
:param wrapped:
:return: