code: def drop(self, labels, dim=None):
          
          if utils.is_scalar(labels):
              labels = [labels]
          if dim is None:
              return self._drop_vars(labels)
          else:
              try:
                  index = self.indexes[dim]
              except KeyError:
                  raise ValueError(
                      'dimension %r does not have coordinate labels' % dim)
              new_index = index.drop(labels)
              return self.loc[{dim: new_index}]
docs: Drop variables or index labels from this dataset.
  
          Parameters
          ----------
          labels : scalar or list of scalars
              Name(s) of variables or index labels to drop.
          dim : None or str, optional
              Dimension along which to drop index labels. By default (if
              ``dim is None``), drops variables rather than index labels.
  
          Returns
          -------
          dropped : Dataset