def notify_status(self, notifications):
        """ :param: recipients: dictionary with a tuple of recipients as key and a list of tuples (body, resource_instance) as value. """

        for recipients in notifications:
            current_notifications = list(notifications[recipients])
            current_notifications.sort(lambda (body1, resource_instance1), (body2, resource_instance2) : cmp(unicode(resource_instance1), unicode(resource_instance2)))

            resources = map(lambda (body, resource_instance) : resource_instance, current_notifications)
            bodies    = map(lambda (body, resource_instance) : body, current_notifications)

            subject = "[WebLab] %s Status changes. " % len(resources)
            shown = 2
            resource_types = list(set(map(lambda resource : unicode(resource.resource_type), resources)))
            subject += ', '.join(resource_types[:shown])
            if len(resource_types) > shown:
                subject += '...'
            
            if 1 > len(bodies):
                body = "%s notifications\n\n" % len(bodies)
            else:
                body = "1 notification\n\n"
            body += '\n\n*****************************\n\n'.join(bodies)
            self.notifier.notify( recipients = recipients, body = body, subject = subject)
dataset/ETHPy150Open weblabdeusto/weblabdeusto/server/src/weblab/core/coordinator/coordinator.py/AbstractCoordinator.notify_status/swapped operands of `>`