async def load_variant(obj, elem, elem_type=None, params=None, field_archiver=None, wrapped=None):
field_archiver = field_archiver if field_archiver else load_field<EOL>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>fvalue = await field_archiver(obj[fname], field[<NUM_LIT:1>], field[<NUM_LIT:2>:], elem if not is_wrapped else None)<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>raise ValueError('<STR_LIT>' % fname)<EOL>
Loads variant from the obj representation
:param obj:
:param elem:
:param elem_type:
:param params:
:param field_archiver:
:param wrapped:
:return: