* @param perms Axes to transpose
     * @return The transposed multiarray
     */
    public static PyMultiarray transpose(final PyObject o, final int[] perms) {
        final PyMultiarray a = PyMultiarray.asarray(o);
        final boolean[] used = new boolean[perms.length];
        for (int i = 0; i < perms.length; i++) {
            int axis = perms[i];
            axis = (axis < 0) ? a.dimensions.length + axis : axis;
            if (axis < 0 || axis >= a.dimensions.length || used[axis]) {
            	throw Py.ValueError("illegal permutation");
            }
            perms[i] = axis;
            used[axis] = true;
        }
        final PyMultiarray ans = new PyMultiarray(
                a.data,
                a._typecode,
                a.start,
                a.dimensions.clone(),
                a.strides.clone());
        for (int i = 0; i < perms.length; i++) {
            ans.dimensions[i] = a.dimensions[perms[i]];
            ans.strides[i] = a.strides[perms[i]];
        }
        ans.setIsContiguous();
        return ans;
    }