def make_gatherer(cls, cell, source_tiers, gatherby):
        """ Produce a single source tier that gathers from a set of tiers when
        the key function returns a unique result for each tier. """
        pending = collections.defaultdict(dict)
        tier_hashes = [hash(x) for x in source_tiers]

        @asyncio.coroutine
        def organize(route, *args):
            srchash = hash(route.source)
            key = gatherby(*args)
            group = pending[key]
            assert srchash not in group
            group[srchash] = args
            if len(group) == len(tier_hashes):
                del pending[key]
                yield from route.emit(*[group[x] for x in tier_hashes])
        return cls(cell, organize)
def make_gatherer ( cls , cell , source_tiers , gatherby ) : pending = collections . defaultdict ( dict ) tier_hashes = [ hash ( x ) for x in source_tiers ] @ asyncio . coroutine def organize ( route , * args ) : srchash = hash ( route . source ) key = gatherby ( * args ) group = pending [ key ] assert srchash not in group group [ srchash ] = args if len ( group ) == len ( tier_hashes ) : del pending [ key ] yield from route . emit ( * [ group [ x ] for x in tier_hashes ] ) return cls ( cell , organize )
Produce a single source tier that gathers from a set of tiers when
        the key function returns a unique result for each tier.