'Compare Messages, taking into account plural ids'

def __cmp__(self, obj):

    if isinstance(obj, Message):
        plural = self.pluralizable
        obj_plural = obj.pluralizable
        if (plural and obj_plural):
            return cmp(self.id[0], obj.id[0])
        elif plural:
            return cmp(self.id[0], obj.id)
        elif obj_plural:
            return cmp(self.id, obj.id[0])
    return cmp(self.id, obj.id)
