def _fa(items, s):
 if atomp(items):
  return items
 if (len(s) == 0):
  return items[0]
 lst = ([0] * s[0])
 stride = s[0]
 for i in range(s[0]):
  lst[i] = _fa(items[i::stride], s[1:])
 return lst

def _fa ( items , s ) : if atomp ( items ) : return items if ( len ( s ) == 0 ) : return items [ 0 ] lst = ( [ 0 ] * s [ 0 ] ) stride = s [ 0 ] for i in range ( s [ 0 ] ) : lst [ i ] = _fa ( items [ i : : stride ] , s [ 1 : ] ) return lst
convert flat item list to the nested list representation of a multidimensional fortran array with shape s .