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

    if (batch_size and (len(states) > batch_size)):
        raise ValueError('Combined    state    is    larger    than    the    requested    batch    size')
    def stack_and_pad(*states):
        stacked = np.stack(states)
        if batch_size:
            stacked.resize(([batch_size] + list(stacked.shape)[1:]))
        return stacked
    return tf_nest.map_structure(stack_and_pad, *states)

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

def batch(states, batch_size=None):