def _drop_mr_cat_dims(self, array, fix_valids=False):
        """Return ndarray reflecting *array* with MR_CAT dims dropped.

        If any (except 1st) dimension has a single element, it is
        flattened in the resulting array (which is more convenient for the
        users of the CrunchCube).

        If the original shape of the cube is needed (e.g. to calculate the
        margins with correct axis arguments), this needs to happen before the
        call to this method '_drop_mr_cat_dims'.
        """
        # TODO: We cannot arbitrarily drop any dimension simply because it
        # has a length (shape) of 1. We must target MR_CAT dimensions
        # specifically. Otherwise unexpected results can occur based on
        # accidents of cube category count etc. If "user-friendly" reshaping
        # needs be done, it should be as a very last step and much safer to
        # leave that to the cr.cube client; software being "helpful" almost
        # never is.

        if not array.shape or len(array.shape) != len(self._all_dimensions):
            # This condition covers two cases:
            # 1. In case of no dimensions, the shape of the array is empty
            # 2. If the shape was already fixed, we don't need to fix it again.
            # This might happen while constructing the masked arrays. In case
            # of MR, we will have the selections dimension included thoughout
            # the calculations, and will only remove it before returning the
            # result to the user.
            return array

        # We keep MR selections (MR_CAT) dimensions in the array, all the way
        # up to here. At this point, we need to remove the non-selected part of
        # selections dimension (and subsequently purge the dimension itself).

        display_ind = (
            tuple(
                0 if dim.dimension_type == DT.MR_CAT else slice(None)
                for dim, n in zip(self._all_dimensions, array.shape)
            )
            if not fix_valids
            else np.ix_(
                *[
                    dim.valid_elements.element_idxs if n > 1 else [0]
                    for dim, n in zip(self._all_dimensions, array.shape)
                ]
            )
        )
        array = array[display_ind]

        # If a first dimension only has one element, we don't want to
        # remove it from the shape. Hence the i == 0 part. For other dimensions
        # that have one element, it means that these are the remnants of the MR
        # selections, which we don't need as separate dimensions.
        new_shape = [
            length for (i, length) in enumerate(array.shape) if length != 1 or i == 0
        ]
        return array.reshape(new_shape)
Return ndarray reflecting *array* with MR_CAT dims dropped.

        If any (except 1st) dimension has a single element, it is
        flattened in the resulting array (which is more convenient for the
        users of the CrunchCube).

        If the original shape of the cube is needed (e.g. to calculate the
        margins with correct axis arguments), this needs to happen before the
        call to this method '_drop_mr_cat_dims'.