'Validate a variant spec against this package variant. Raises an
exception if any error is found.
Args:
vspec (VariantSpec): instance to be validated
pkg (Package): the package that required the validation,
if available
Raises:
InconsistentValidationError: if ``vspec.name != self.name``
MultipleValuesInExclusiveVariantError: if ``vspec`` has
multiple values but ``self.multi == False``
InvalidVariantValueError: if ``vspec.value`` contains
invalid values'

def validate_or_raise(self, vspec, pkg=None):

    if (self.name != vspec.name):
        raise InconsistentValidationError(vspec, self)
    value = vspec.value
    if isinstance(vspec.value, (bool, str)):
        value = (vspec.value,)
    if ((not self.multi) and (len(value) != 1)):
        raise MultipleValuesInExclusiveVariantError(vspec, pkg)
    not_allowed_values = [x for x in value if (not self.single_value_validator(x))]
    if not_allowed_values:
        raise InvalidVariantValueError(self, not_allowed_values, pkg)
    if (self.group_validator is not None):
        self.group_validator(value)
