code: def _maybe_unstack(self, obj):
          
          if self._stacked_dim is not None and self._stacked_dim in obj.dims:
              obj = obj.unstack(self._stacked_dim)
              for dim in self._inserted_dims:
                  if dim in obj.coords:
                      del obj.coords[dim]
          return obj
docs: This gets called if we are applying on an array with a
          multidimensional group.