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

    N = len(ranges)
    if (N > 40):
        raise ValueError('Brute    Force    not    possible    with    more    than    40    variables.')
    lrange = list(ranges)
    for k in range(N):
        if (type(lrange[k]) is not type(slice(None))):
            if (len(lrange[k]) < 3):
                lrange[k] = (tuple(lrange[k]) + (complex(Ns),))
            lrange[k] = slice(*lrange[k])
    if (N == 1):
        lrange = lrange[0]
    def _scalarfunc(*params):
        params = squeeze(asarray(params))
        return func(params, *args)
    vecfunc = vectorize(_scalarfunc)
    grid = mgrid[lrange]
    if (N == 1):
        grid = (grid,)
    Jout = vecfunc(*grid)
    Nshape = shape(Jout)
    indx = argmin(Jout.ravel(), axis=(-1))
    Nindx = zeros(N, int)
    xmin = zeros(N, float)
    for k in range((N - 1), (-1), (-1)):
        thisN = Nshape[k]
        Nindx[k] = (indx % Nshape[k])
        indx = (indx // thisN)
    for k in range(N):
        xmin[k] = grid[k][tuple(Nindx)]
    Jmin = Jout[tuple(Nindx)]
    if (N == 1):
        grid = grid[0]
        xmin = xmin[0]
    if callable(finish):
        finish_args = _getargspec(finish).args
        finish_kwargs = dict()
        if ('full_output' in finish_args):
            finish_kwargs['full_output'] = 1
        if ('disp' in finish_args):
            finish_kwargs['disp'] = disp
        elif ('options' in finish_args):
            finish_kwargs['options'] = {'disp': disp}
        res = finish(func, xmin, args=args, **finish_kwargs)
        if isinstance(res, OptimizeResult):
            xmin = res.x
            Jmin = res.fun
            success = res.success
        else:
            xmin = res[0]
            Jmin = res[1]
            success = (res[(-1)] == 0)
        if (not success):
            if disp:
                print('Warning:    Either    final    optimization    did    not    succeed    or    `finish`    does    not    return    `statuscode`    as    its    last    argument.')
    if full_output:
        return (xmin, Jmin, grid, Jout)
   ...

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

def brute(func, ranges, args=(), Ns=20, full_output=0, finish=fmin, disp=False):