async def load_variant(self, elem_type, params=None, elem=None, wrapped=None, obj=None):
is_wrapped = elem_type.WRAPS_VALUE if wrapped is None else wrapped<EOL>if is_wrapped:<EOL><INDENT>elem = elem_type() if elem is None else elem<EOL><DEDENT>fname = list(obj.keys())[<NUM_LIT:0>]<EOL>for field in elem_type.f_specs():<EOL><INDENT>if field[<NUM_LIT:0>] != fname:<EOL><INDENT>continue<EOL><DEDENT>try:<EOL><INDENT>self.tracker.push_variant(field[<NUM_LIT:1>])<EOL>fvalue = await self._load_field(field[<NUM_LIT:1>], field[<NUM_LIT:2>:], elem if not is_wrapped else None, obj=obj[fname])<EOL>self.tracker.pop()<EOL><DEDENT>except Exception as e:<EOL><INDENT>raise helpers.ArchiveException(e, tracker=self.tracker) from e<EOL><DEDENT>if is_wrapped:<EOL><INDENT>elem.set_variant(field[<NUM_LIT:0>], fvalue)<EOL><DEDENT>return elem if is_wrapped else fvalue<EOL><DEDENT>raise ValueError('<STR_LIT>' % fname)<EOL>
Loads variant type from the reader.
Supports both wrapped and raw variant.

:param elem_type:
:param params:
:param elem:
:param wrapped:
:param obj:
:return: