human
I wrote the below code

    checked_variables = set()
    def check_variable_norec(new_r):
        '\n                                Verify    that    `r`    has    the    same    value    as    the    results    it    replaces.\n\n                                '
        for (reason, r, old_graph_str, new_graph_str) in reasons[new_r]:
            new_r_val = r_vals[new_r]
            r_val = r_vals[r]
            if ((r.type != new_r.type) or (not r.type.values_eq_approx(r_val, new_r_val))):
                raise BadOptimization(old_r=r, new_r=new_r, old_r_val=r_val, new_r_val=new_r_val, reason=reason, old_graph=old_graph_str, new_graph=new_graph_str)
    def check_variable(r):
        if (r in checked_variables):
            return
        checked_variables.add(r)
        list_of_vars = [old_r for (reason, old_r, olds, news) in reasons[r]]
        if (None is not r.owner):
            list_of_vars += r.owner.inputs
        for var_that_could_make_r_look_bad in list_of_vars:
            check_variable(var_that_could_make_r_look_bad)
        check_variable_norec(r)
    for (i, node) in enumerate(order):
        for new_r in node.outputs:
            check_variable(new_r)

What's a good function header?

=====
Here's a good function header?
assistant
#Here's a good function header.

def _find_bad_optimizations2(order, reasons, r_vals):