def arr_to_2d(arr, oned_as='row'):
 dims = matdims(arr, oned_as)
 if (len(dims) > 2):
  raise ValueError('Matlab 4 files cannot save arrays with more than 2 dimensions')
 return arr.reshape(dims)

def arr_to_2d ( arr , oned_as = 'row' ) : dims = matdims ( arr , oned_as ) if ( len ( dims ) > 2 ) : raise ValueError ( 'Matlab 4 files cannot save arrays with more than 2 dimensions' ) return arr . reshape ( dims )
make arr exactly two dimensional if arr has more than 2 dimensions .