human
I wrote the below code

    def inds(i, ind):
        rv = []
        if ((ind - 0.9) > 0):
            rv.append((ind - 0.9))
        rv.append(ind)
        if ((ind + 0.9) < (dims[i] - 1)):
            rv.append((ind + 0.9))
        return rv
    shape = []
    for (i, ind) in enumerate(k[1:]):
        num = 1
        if (ind > 0):
            num += 1
        if (ind < (dims[i] - 1)):
            num += 1
        shape.append(num)
    seq = list(product([k[0]], *[inds(i, ind) for (i, ind) in enumerate(k[1:])]))
    return reshapelist(shape, seq)

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

def expand_key(k, dims):