def printSummary(self):
        """ independent of type of session or task you get an overview """
        succeeded, failed = 0, 0
        taskDurations     = []
        sessionDurations  = []
        lastSession       = None

        for sessions in self.sessionsByKey.values():
            for session in sessions:
                sessionDurations.append(session.getDuration())
                for task in session:
                    taskDurations.append(task.getDuration())

                    if task.isValid():
                        succeeded += 1
                    else:
                        failed += 1

                if not lastSession:
                    lastSession = session
                elif session.finished > lastSession.finished:
                    lastSession = session

        # the first time you have no tasks yet
        if not len(taskDurations):
            return

        errorRate = failed * 100.0 / len(taskDurations)

        print("\n...last session has been %s"
              % (Tools.dateBack(lastSession.finished) + " ago"))
        print("...overall number of sessions is %d"
              % len(sessionDurations))
        print("...overall number of tasks is %d, %d succeeded, %d failed - error rate is about %.1f%%"
              % (len(taskDurations), succeeded, failed, errorRate))
        print("...best task time was %f seconds, longest task time was %f seconds"
              % (min(taskDurations), max(taskDurations)))
        print("...best session time was %f seconds, longest session time was %f seconds"
              % (min(sessionDurations), max(sessionDurations)))
        print("...average time over all kind of tasks is %f seconds"
              % (sum(taskDurations)/len(taskDurations)))
        print("...average time over all kind of sessions is %f seconds"
              % (sum(sessionDurations)/len(sessionDurations)))
        print("...overall session time %f seconds"
              % (sum(sessionDurations)))
 independent of type of session or task you get an overview 
recipes/Python/578111_Learning_calculate_mental/recipe-578111.py