@classmethod
    def get_entities_for_lists(cls, ids):

        lists = TopList.multiget(ids)
        list_names = dict((l.id, l.title) for l in lists)

        # list of lists, return value
        top_lists = OrderedDict()
        
        # item_id => entity
        item_id_dict = {}
        entity_dict = {}

        list_id_dict = defaultdict(list)
        
        all_items=TopList.multiget_items(ids)
        # Spits out a dict like {1: [TopListItem(...), TopListItem(...)] }
        [list_id_dict[item.list_id].append(item) for item in all_items]

        keyfunc = lambda item: item.entity_content_type_id

        # Can potentially have hybrid featured lists,
        # so use groupby
        for entity_type, list_items in groupby(sorted(all_items, key=keyfunc), keyfunc):
            item_entity_dict = dict((i.id, i.entity_id) for i in list_items)
            
            cls = ContentType.objects.get(id=entity_type).model_class()            
            entities = cls.multiget(set(item_entity_dict.values()))
            for ent in entities:
                entity_dict[(entity_type, ent.id)] = ent
 
        for list_id in ids:
            entities = [entity_dict[(item.entity_content_type_id, item.entity_id)] for item in list_id_dict[list_id]]
            top_lists[list_names[list_id]] = entities

        return top_lists
Declare the queue on the RabbitMQ channel passed into the
dataset/ETHPy150Open jumoconnect/openjumo/jumodjango/popularity/models.py/TopList.get_entities_for_lists--crossover with--dataset/ETHPy150Open gmr/rabbitpy/rabbitpy/amqp_queue.py/Queue.declare