<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_rule(self, template_name):
 """Find a matching compilation rule for a function. Raises a :exc:`ValueError` if no matching rule can be found. :param template_name: the name of the template """

        for regex, render_func in self.rules:
            if re.match(regex, template_name):
                return render_func
        raise ValueError("no matching rule")