human
I wrote the below code

    fc = [0]
    gc = [0]
    gval = [None]
    gval_alpha = [None]
    def phi(alpha):
        fc[0] += 1
        return f((xk + (alpha * pk)), *args)
    if isinstance(myfprime, tuple):
        def derphi(alpha):
            fc[0] += (len(xk) + 1)
            eps = myfprime[1]
            fprime = myfprime[0]
            newargs = ((f, eps) + args)
            gval[0] = fprime((xk + (alpha * pk)), *newargs)
            gval_alpha[0] = alpha
            return np.dot(gval[0], pk)
    else:
        fprime = myfprime
        def derphi(alpha):
            gc[0] += 1
            gval[0] = fprime((xk + (alpha * pk)), *args)
            gval_alpha[0] = alpha
            return np.dot(gval[0], pk)
    if (gfk is None):
        gfk = fprime(xk, *args)
    derphi0 = np.dot(gfk, pk)
    if (extra_condition is not None):
        def extra_condition2(alpha, phi):
            if (gval_alpha[0] != alpha):
                derphi(alpha)
            x = (xk + (alpha * pk))
            return extra_condition(alpha, x, phi, gval[0])
    else:
        extra_condition2 = None
    (alpha_star, phi_star, old_fval, derphi_star) = scalar_search_wolfe2(phi, derphi, old_fval, old_old_fval, derphi0, c1, c2, amax, extra_condition2, maxiter=maxiter)
    if (derphi_star is None):
        warn('The    line    search    algorithm    did    not    converge', LineSearchWarning)
    else:
        derphi_star = gval[0]
    return (alpha_star, fc[0], gc[0], phi_star, old_fval, derphi_star)

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

def line_search_wolfe2(f, myfprime, xk, pk, gfk=None, old_fval=None, old_old_fval=None, args=(), c1=0.0001, c2=0.9, amax=None, extra_condition=None, maxiter=10):