code: def remove_targets(self, type, kept=None):
          '''Remove targets of certain type'''
          if kept is None:
              kept = [
                  i for i, x in enumerate(self._targets)
                  if not isinstance(x, type)
              ]
          if len(kept) == len(self._targets):
              return self
          self._targets = [self._targets[x] for x in kept]
          self._labels = [self._labels[x] for x in kept]
          if not self._groups:
              return self
          index_map = {
              o_idx: n_idx
              for n_idx, o_idx in zip(range(len(self._targets)), kept)
          }
          kept = set(kept)
          for idx, grp in enumerate(self._groups):
              self._groups[idx] = _sos_group(
                  [index_map[x] for x in grp._indexes if x in kept],
                  [y for x, y in zip(grp._indexes, grp._labels) if x in kept
                  ]).set(**grp._dict)
          return self remove_targets(self, type, kept=None):
          '''Remove targets of certain type'''
          if kept is None:
              kept = [
                  i for i, x in enumerate(self._targets)
                  if not isinstance(x, type)
              ]
          if len(kept) == len(self._targets):
              return self
          self._targets = [self._targets[x] for x in kept]
          self._labels = [self._labels[x] for x in kept]
          if not self._groups:
              return self
          index_map = {
              o_idx: n_idx
              for n_idx, o_idx in zip(range(len(self._targets)), kept)
          }
          kept = set(kept)
          for idx, grp in enumerate(self._groups):
              self._groups[idx] = _sos_group(
                  [index_map[x] for x in grp._indexes if x in kept],
                  [y for x, y in zip(grp._indexes, grp._labels) if x in kept
                  ]).set(**grp._dict)
          return self
docs: Remove targets of certain type