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

    if (fn is None):
        def fun(x, *args):
            return (x * self.pdf(x, loc=loc, scale=scale, *args))
    else:
        def fun(x, *args):
            return (fn(x) * self.pdf(x, loc=loc, scale=scale, *args))
    if (lb is None):
        lb = (loc + (self.a * scale))
    if (ub is None):
        ub = (loc + (self.b * scale))
    if conditional:
        invfac = (self.sf(lb, loc=loc, scale=scale, *args) - self.sf(ub, loc=loc, scale=scale, *args))
    else:
        invfac = 1.0
    return (integrate.quad(fun, lb, ub, args=args)[0] / invfac)

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

def expect(self, fn=None, args=(), loc=0, scale=1, lb=None, ub=None, conditional=False):