human
Complete the below
def condition(cond, rule):

    ''''Only apply rule if condition is true'
    '''
assistant
#Here is the Python code you requested.
    def conditioned_rl(expr):
        if cond(expr):
            return rule(expr)
        else:
            return expr
    return conditioned_rl