def groupby_status(self):
        """
        Returns a ordered dictionary mapping the task status to
        the list of named tuples (task, work_index, task_index).
        """
        Entry = collections.namedtuple("Entry", "task wi ti")
        d = collections.defaultdict(list)

        for task, wi, ti in self.iflat_tasks_wti():
            d[task.status].append(Entry(task, wi, ti))

        # Sort keys according to their status.
        return OrderedDict([(k, d[k]) for k in sorted(list(d.keys()))])