def METHOD_NAME(cond, rule):
    """Only apply rule if condition is true."""
    def conditioned_rl(expr):
        if cond(expr):
            return rule(expr)
        return expr
    return conditioned_rl