* @param axis The axis along which the arrays will be joined. Default: 0.
     * @return The concatenated array.
     */
    public static PyMultiarray concatenate(final PyObject po, int axis) {
        if (po.__len__() == 0) { return PyMultiarray.zeros(new int[] {}, 'i'); }
        // Check axis and rotate the axis to zero.
        PyMultiarray proto = PyMultiarray.asarray(po.__getitem__(0));
        if (axis < 0) {
            axis += proto.dimensions.length;
        }
        if (axis < 0 || axis >= proto.dimensions.length) {
        	throw Py.ValueError("illegal axis");
        }
        // Make array of multiarrays.
        final PyMultiarray[] as = new PyMultiarray[po.__len__()];
        as[0] = proto = PyMultiarray.rotateAxes(proto, -axis);
        char type = proto.typecode();
        final int[] dimensions = proto.dimensions.clone();
        for (int i = 1; i < as.length; i++) {
            as[i] = PyMultiarray.rotateAxes(
                    PyMultiarray.asarray(po.__getitem__(i)),
                    -axis);
            type = PyMultiarray.commonType(type, as[i]._typecode);
            if (as[i].dimensions.length != proto.dimensions.length) {
            	throw Py.ValueError("mismatched array dimensions");
            }
            for (int j = 1; j < proto.dimensions.length; j++) {
                if (as[i].dimensions[j] != proto.dimensions[j]) {
                	throw Py.ValueError("mismatched array dimensions");
                }
            }
            dimensions[0] += as[i].dimensions[0];
        }
        // Construct the result.
        final PyMultiarray result = PyMultiarray.zeros(dimensions, type);
        int start = 0;
        for (final PyMultiarray element : as) {
            final int end = start + element.dimensions[0];
            result.setslice(start, end, 1, element);
            start = end;
        }
        // Rotate axes back and return result.
        return PyMultiarray.rotateAxes(result, axis);
    }