static int[] objectToInts(final Object jo, final boolean forgiving) {
        if (jo instanceof int[]) { return (int[]) jo; }

        if (!(jo instanceof PyObject)) { throw Py
                .ValueError("cannot convert argument to array of ints"); }
        PyObject o = (PyObject) jo;
        if (PyMultiarray.shapeOf(o).length == 0) {
            if (forgiving) {
                // return new int []
                // {asarray(o).__getitem__(Py.Ellipsis).__int__().getValue()};
                o = PyMultiarray.asarray(o).__getitem__(Py.Ellipsis);
            } else {
                throw Py.ValueError("cannot convert argument to array of ints");
            }
        }
        int length;
        try {
            length = o.__len__();
        } catch (final Throwable t) {
            return new int[] { Py.py2int(o) };
        }
        final int[] intArray = new int[length];
        for (int i = 0; i < intArray.length; i++) {
            final PyObject item = o.__getitem__(i);
            if (!forgiving && !(item instanceof PyInteger)) { throw Py
                    .ValueError("cannot convert argument to array of ints"); }
            intArray[i] = Py.py2int(o.__getitem__(i));
        }
        return intArray;
    }