code: def keep_only_these_categories(self, categories, ignore_absences=False):
          '''
          Non destructive category removal.
  
          Parameters
          ----------
          categories : list
              list of categories to keep
          ignore_absences : bool, False by default
              if categories does not appear, don't raise an error, just move on.
  
          Returns
          -------
          TermDocMatrix, new object with categories removed.
          '''
          if not ignore_absences:
              assert set(self.get_categories()) & set(categories) == set(categories)
          categories_to_remove = [c for c in self.get_categories() if c not in categories]
          return self.remove_categories(categories_to_removef keep_only_these_categories(self, categories, ignore_absences=False):
          '''
          Non destructive category removal.
  
          Parameters
          ----------
          categories : list
              list of categories to keep
          ignore_absences : bool, False by default
              if categories does not appear, don't raise an error, just move on.
  
          Returns
          -------
          TermDocMatrix, new object with categories removed.
          '''
          if not ignore_absences:
              assert set(self.get_categories()) & set(categories) == set(categories)
          categories_to_remove = [c for c in self.get_categories() if c not in categories]
          return self.remove_categories(categories_to_remove)
docs: Non destructive category removal.
  
          Parameters
          ----------
          categories : list
              list of categories to keep
          ignore_absences : bool, False by default
              if categories does not appear, don't raise an error, just move on.
  
          Returns
          -------
          TermDocMatrix, new object with categories removed.