* @param axis Axis over which to sort
     * @return A new, sorted array
     */
    public static PyMultiarray sort(final PyObject o, final int axis) {
        final PyMultiarray a = PyMultiarray.array(PyMultiarray.swapAxes(
                PyMultiarray.asarray(o),
                axis,
                -1));
        final int stride = a.dimensions[a.dimensions.length - 1];
        for (int i = 0; i < Array.getLength(a.data); i += stride) {
            switch (a._typecode) {
            case '1':
                java.util.Arrays.sort((byte[]) a.data, i, i + stride);
                break;
            case 's':
                java.util.Arrays.sort((short[]) a.data, i, i + stride);
                break;
            case 'i':
                java.util.Arrays.sort((int[]) a.data, i, i + stride);
                break;
            case 'l':
                java.util.Arrays.sort((long[]) a.data, i, i + stride);
                break;
            case 'f':
                java.util.Arrays.sort((float[]) a.data, i, i + stride);
                break;
            case 'd':
                java.util.Arrays.sort((double[]) a.data, i, i + stride);
                break;
            default:
                throw Py.ValueError("unsortable array type");
            }
        }
        return PyMultiarray.swapAxes(a, axis, -1);
    }