human
I wrote the below code

    def _int64_cut_off(shape):
        acc = long(1)
        for (i, mul) in enumerate(shape):
            acc *= long(mul)
            if (not (acc < _INT64_MAX)):
                return i
        return len(shape)
    def loop(labels, shape):
        nlev = _int64_cut_off(shape)
        stride = np.prod(shape[1:nlev], dtype='i8')
        out = (stride * labels[0].astype('i8', subok=False, copy=False))
        for i in range(1, nlev):
            if (shape[i] == 0):
                stride = 0
            else:
                stride //= shape[i]
            out += (labels[i] * stride)
        if xnull:
            mask = (labels[0] == (-1))
            for lab in labels[1:nlev]:
                mask |= (lab == (-1))
            out[mask] = (-1)
        if (nlev == len(shape)):
            return out
        (comp_ids, obs_ids) = compress_group_index(out, sort=sort)
        labels = ([comp_ids] + labels[nlev:])
        shape = ([len(obs_ids)] + shape[nlev:])
        return loop(labels, shape)
    def maybe_lift(lab, size):
        return (((lab + 1), (size + 1)) if (lab == (-1)).any() else (lab, size))
    labels = map(_ensure_int64, labels)
    if (not xnull):
        (labels, shape) = map(list, zip(*map(maybe_lift, labels, shape)))
    return loop(list(labels), list(shape))

What's a good function header?

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

def get_group_index(labels, shape, sort, xnull):