private final static void checkResultArray(final PyMultiarray result, final PyMultiarray a, final PyMultiarray b) {
        if (result._typecode != a._typecode) { throw Py
                .ValueError("return array has incorrect type."); }
        if (result.dimensions.length != a.dimensions.length) { throw Py
                .ValueError("return array has the wrong number of dimensions"); }
        for (int i = 0; i < result.dimensions.length; i++) {
            if (result.dimensions[i] != Math.max(
                    a.dimensions[i],
                    b.dimensions[i])) { throw Py
                    .ValueError("return array has incorrect dimensions"); }
        }
    }