def _get_rule_penalty(self, rule):
    """Computes the penalty for a given rule."""
    if rule not in self.rule_to_penalty:
      self.rule_to_penalty[rule] = _get_rule_penalty(rule, self.config,
                                                     self.examples)
    return self.rule_to_penalty[rule]
Computes the penalty for a given rule.
language/compgen/csl/induction/objective_utils.py