[python] From ND to 1D arrays