private static final int getIndex(final PyObject index, final int defaultValue) {
        if (index == Py.None || index == null) { return defaultValue; }
        if (!(index instanceof PyInteger)) { throw Py
                .TypeError("slice index must be int"); }
        return ((PyInteger) index).getValue();
    }