human
Here's a good function header given the following:
I wrote the below code

    def _f(rv):
        if (not (rv.is_Pow and (rv.base.func == f))):
            return rv
        if ((rv.exp < 0) == True):
            return rv
        if ((rv.exp > max) == True):
            return rv
        if (rv.exp == 2):
            return h((g(rv.base.args[0]) ** 2))
        else:
            if (rv.exp == 4):
                e = 2
            elif (not pow):
                if (rv.exp % 2):
                    return rv
                e = (rv.exp // 2)
            else:
                p = perfect_power(rv.exp)
                if (not p):
                    return rv
                e = (rv.exp // 2)
            return (h((g(rv.base.args[0]) ** 2)) ** e)
    return bottom_up(rv, _f)

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

def _TR56(rv, f, g, h, max, pow):