code: async def load_variant(self, elem_type, params=None, elem=None, wrapped=None):
          
          is_wrapped = (isinstance(elem, x.VariantType) or elem_type.WRAPS_VALUE) if wrapped is None else wrapped
          if is_wrapped:
              elem = elem_type() if elem is None else elem
  
          tag = await load_uvarint(self.iobj)
          for field in elem_type.f_specs():
              ftype = field[1]
              vcode = ftype.BOOST_VARIANT_CODE if hasattr(ftype, 'BOOST_VARIANT_CODE') else ftype.VARIANT_CODE
              if vcode != tag:
                  continue
  
              fvalue = await self._load_field(ftype, field[2:], elem if not is_wrapped else None)
              if is_wrapped:
                  elem.set_variant(field[0], fvalue)
              return elem if is_wrapped else fvalue
  
          raise ValueError('Unknown tag: %s, path: %s' % (tag, self.tracker))
docs: Loads variant type from the reader.
          Supports both wrapped and raw variant.
  
          :param reader:
          :param elem_type:
          :param params:
          :param elem:
          :param wrapped:
          :return: