code: def pad_array(v, idx):
      
      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)])
docs: Expand lists in multidimensional arrays to pad unset values.