* @param oIndices The indices of the values to extract.
     * @param axis The axis over which to select values.
     * @return The returned array has the same type as oA.
     */
    public static PyMultiarray take(final PyObject oA, final PyObject oIndices, int axis) {
        PyMultiarray a = PyMultiarray.asarray(oA), indices = PyMultiarray
                .asarray(oIndices);
        // Check axis and rotate the axis to zero.
        if (axis < 0) {
            axis += a.dimensions.length;
        }
        if (axis < 0 || axis >= a.dimensions.length) { throw Py
                .ValueError("illegal axis"); }
        a = PyMultiarray.ascontiguous(PyMultiarray.rotateAxes(a, -axis));
        // Check indices argument, copy and cast to integer.
        indices = PyMultiarray.array(indices, 'i');
        if (indices.dimensions.length != 1) { throw Py
                .ValueError("wrong number of dimensions"); }
        // Create the result array.
        final int[] dimensions = a.dimensions.clone();
        dimensions[0] = indices.dimensions[0];
        final PyMultiarray result = PyMultiarray.zeros(dimensions, a._typecode);
        final int stride = result.strides[0];
        final int start = a.start;
        for (int i = 0; i < indices.dimensions[0]; i++) {
            final int item = Array.getInt(indices.data, i);
            for (int j = 0; j < stride; j++) {
                Array.set(
                        result.data,
                        i * stride + j,
                        Array.get(a.data, start + item * stride + j));
            }
        }
        // Rotate axis of result back to where it belongs and return.
        return PyMultiarray.rotateAxes(result, axis);
    }