def METHOD_NAME(self, spec):
    """Checks the validity of the provided spec."""
    # Reserved for community integration
    if spec.startswith(tuple(self.reserved_prefixes)):
        raise ValidationError(
            _(
                "The spec must not start with any of the following list '{prefix}'.".format(
                    prefix=list(self.reserved_prefixes)
                )
            ),
            field_name="spec",
        )
    # See https://www.openarchives.org/OAI/openarchivesprotocol.html#Set
    blop = re.compile(r"[-_.!~*'()\w]+")
    if not bool(blop.match(spec)):
        raise ValidationError(
            _(
                "The spec must only consist of letters, numbers or {marks}.".format(
                    marks=",".join(["-", "_", ".", "!", "~", "*", "'", "(", ")"])
                )
            ),
            field_name="spec",
        )