protected int fixIndex(int index, final int axis) {
        if (index < 0) {
            index += this.dimensions[axis];
        }
        if (index < 0 || index >= this.dimensions[axis]) {
            throw Py.IndexError("index out of range");
        } else {
            return index;
        }
    }