code: def group(self, p_todos):
          p_todos = _apply_sort_functions(p_todos, self.pregroupfunctions)
          result = OrderedDict([((), p_todos)])
          for (function, label), _ in self.groupfunctions:
              oldresult = result
              result = OrderedDict()
              for oldkey, oldgroup in oldresult.items():
                  for key, _group in groupby(oldgroup, function):
                      newgroup = list(_group)
                      if not isinstance(key, list):
                          key = [key]
                      for subkey in key:
                          subkey = "{}: {}".format(label, subkey)
                          newkey = oldkey + (subkey,)
                          if newkey in result:
                              result[newkey] = result[newkey] + newgroup
                          else:
                              result[newkey] = newgroup
          for key, _group in result.items():
              result[key] = self.sort(_group)
          return result