code: def validate(self, class_, tag, contents):
          
  
          id_ = (class_, tag)
  
          if self.explicit is not None:
              if self.explicit[-1] != id_:
                  raise ValueError(unwrap(
                      '''
                      %s was explicitly tagged, but the value provided does not
                      match the class and tag
                      ''',
                      type_name(self)
                  ))
  
              ((class_, _, tag, _, _, _), _) = _parse(contents, len(contents))
              id_ = (class_, tag)
  
          if id_ in self._id_map:
              self._choice = self._id_map[id_]
              return
  
          # This means the Choice was implicitly tagged
          if self.class_ is not None and self.tag is not None:
              if len(self._alternatives) > 1:
                  raise ValueError(unwrap(
                      '''
                      %s was implicitly tagged, but more than one alternative
                      exists
                      ''',
                      type_name(self)
                  ))
              if id_ == (self.class_, self.tag):
                  self._choice = 0
                  return
  
          asn1 = self._format_class_tag(class_, tag)
          asn1s = [self._format_class_tag(pair[0], pair[1]) for pair in self._id_map]
  
          raise ValueError(unwrap(
              '''
              Value %s did not match the class and tag of any of the alternatives
              in %s: %s
              ''',
              asn1,
              type_name(self),
              ', '.join(asn1s)
          ))
docs: Ensures that the class and tag specified exist as an alternative
  
          :param class_:
              The integer class_ from the encoded value header
  
          :param tag:
              The integer tag from the encoded value header
  
          :param contents:
              A byte string of the contents of the value - used when the object
              is explicitly tagged
  
          :raises:
              ValueError - when value is not a valid alternative