'Adds the given rule to this collection.
:param rule: model of a rule
:raises ValueError: raised if there already exists a rule for a given scope and pattern'

def add(self, rule):

    if (rule.pattern in self._rules[rule.scope]):
        patten_info = (("    and    pattern    '%s'" % rule.pattern) if (rule.pattern is not None) else '')
        raise ValueError(("Duplicate    rule    for    scope    '%s'%s" % (rule.scope, patten_info)))
    self._rules[rule.scope][rule.pattern] = rule
