code: async def _load_variant(
              self, reader, elem_type, params=None, elem=None, wrapped=None
      ):
          
          is_wrapped = (
              (isinstance(elem, 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_uint(reader, 1)
          for field in elem_type.f_specs():
              ftype = field[1]
              if ftype.VARIANT_CODE == tag:
                  fvalue = await self.load_field(
                      reader, 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" % tag)
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: