human
I wrote the below code

    _check_unknown_options(unknown_options)
    if (jac is None):
        raise ValueError('Jacobian    is    required    for    Newton-CG    method')
    f = fun
    fprime = jac
    fhess_p = hessp
    fhess = hess
    avextol = xtol
    epsilon = eps
    retall = return_all
    def terminate(warnflag, msg):
        if disp:
            print(msg)
            print(('                                    Current    function    value:    %f' % old_fval))
            print(('                                    Iterations:    %d' % k))
            print(('                                    Function    evaluations:    %d' % fcalls[0]))
            print(('                                    Gradient    evaluations:    %d' % gcalls[0]))
            print(('                                    Hessian    evaluations:    %d' % hcalls))
        fval = old_fval
        result = OptimizeResult(fun=fval, jac=gfk, nfev=fcalls[0], njev=gcalls[0], nhev=hcalls, status=warnflag, success=(warnflag == 0), message=msg, x=xk, nit=k)
        if retall:
            result['allvecs'] = allvecs
        return result
    x0 = asarray(x0).flatten()
    (fcalls, f) = wrap_function(f, args)
    (gcalls, fprime) = wrap_function(fprime, args)
    hcalls = 0
    if (maxiter is None):
        maxiter = (len(x0) * 200)
    cg_maxiter = (20 * len(x0))
    xtol = (len(x0) * avextol)
    update = [(2 * xtol)]
    xk = x0
    if retall:
        allvecs = [xk]
    k = 0
    old_fval = f(x0)
    old_old_fval = None
    float64eps = numpy.finfo(numpy.float64).eps
    while (numpy.add.reduce(numpy.abs(update)) > xtol):
        if (k >= maxiter):
            msg = ('Warning:    ' + _status_message['maxiter'])
            return terminate(1, msg)
        b = (- fprime(xk))
        maggrad = numpy.add.reduce(numpy.abs(b))
        eta = numpy.min([0.5, numpy.sqrt(maggrad)])
        termcond = (eta * maggrad)
        xsupi = zeros(len(x0), dtype=x0.dtype)
        ri = (- b)
        psupi = (- ri)
        i = 0
        dri0 = numpy.dot(ri, ri)
        if...

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

def _minimize_newtoncg(fun, x0, args=(), jac=None, hess=None, hessp=None, callback=None, xtol=1e-05, eps=_epsilon, maxiter=None, disp=False, return_all=False, **unknown_options):