def allstack(vals, depth=<NUM_LIT:0>):
if type(vals[<NUM_LIT:0>]) is ndarray:<EOL><INDENT>return concatenate(vals, axis=depth)<EOL><DEDENT>else:<EOL><INDENT>return concatenate([allstack(x, depth+<NUM_LIT:1>) for x in vals], axis=depth)<EOL><DEDENT>
If an ndarray has been split into multiple chunks by splitting it along
each axis at a number of locations, this function rebuilds the
original array from chunks.

Parameters
----------
vals : nested lists of ndarrays
    each level of nesting of the lists representing a dimension of
    the original array.