code: def regroup(self, group_by=None):
          
          if not group_by:
              group_by = self.group_by
  
          groups = self.groups
          self.groups = {}
  
          for g in groups:
              for item in groups[g]:
                  self.add(item, group_by)
docs: Regroup items.