code: def groupby(cls, dataset, dims, container_type=HoloMap, group_type=None, **kwargs):
          
          import iris
  
          if not isinstance(dims, list): dims = [dims]
          dims = [dataset.get_dimension(d, strict=True) for d in dims]
          constraints = [d.name for d in dims]
          slice_dims = [d for d in dataset.kdims if d not in dims]
  
          # Update the kwargs appropriately for Element group types
          group_kwargs = {}
          group_type = dict if group_type == 'raw' else group_type
          if issubclass(group_type, Element):
              group_kwargs.update(util.get_param_values(dataset))
              group_kwargs['kdims'] = slice_dims
          group_kwargs.update(kwargs)
  
          drop_dim = any(d not in group_kwargs['kdims'] for d in slice_dims)
  
          unique_coords = product(*[cls.values(dataset, d, expanded=False)
                                    for d in dims])
          data = []
          for key in unique_coords:
              constraint = iris.Constraint(**dict(zip(constraints, key)))
              extracted = dataset.data.extract(constraint)
              if drop_dim:
                  extracted = group_type(extracted, kdims=slice_dims,
                                         vdims=dataset.vdims).columns()
              cube = group_type(extracted, **group_kwargs)
              data.append((key, cube))
          if issubclass(container_type, NdMapping):
              with item_check(False), sorted_context(False):
                  return container_type(data, kdims=dims)
          else:
              return container_type(data)
docs: Groups the data by one or more dimensions returning a container
          indexed by the grouped dimensions containing slices of the
          cube wrapped in the group_type. This makes it very easy to
          break up a high-dimensional dataset into smaller viewable chunks.