@classmethod
    def validate_template(cls):
        y = re.findall(cls._MATCH_YEAR, cls._template)
        m = re.findall(cls._MATCH_MONTH, cls._template)
        c = re.findall(cls._MATCH_COUNTER, cls._template)

        if len(y) > 1:
            raise ValidationError('{year} can only be used once')
        if len(m) > 1:
            raise ValidationError('{month} can only be used once')
        if len(m) == 1 and len(y) == 0:
            raise ValidationError('{month} can only be used while {year} is present')
        if len(c) > 1:
            raise ValidationError('{counter:0Nd} can only be used once')
        if len(c) == 0:
            raise ValidationError('{counter:0Nd} must be used once')

        try:
            cls._template.format(year=1999, month=11, counter=1)
        except __HOLE__:
            raise ValidationError('The string has the wrong format')
dataset/ETHPy150Open django-bmf/django-bmf/djangobmf/core/numberrange.py/NumberRange.validate_template