def pad_array(v, idx):
    """Expand lists in multidimensional arrays to pad unset values."""
    i_v, i_s = idx[0]

    if len(idx) > 1:
        # Append missing subarrays
        v.extend([[] for _ in range(len(v), i_v - i_s + 1)])

        # Pad elements
        for e in v:
            pad_array(e, idx[1:])
    else:
        v.extend([None for _ in range(len(v), i_v - i_s + 1)])
def pad_array ( v , idx ) : i_v , i_s = idx [ 0 ] if len ( idx ) > 1 : v . extend ( [ [ ] for _ in range ( len ( v ) , i_v - i_s + 1 ) ] ) for e in v : pad_array ( e , idx [ 1 : ] ) else : v . extend ( [ None for _ in range ( len ( v ) , i_v - i_s + 1 ) ] )
Expand lists in multidimensional arrays to pad unset values.