def _gather_dependencies(self, container):
        containers = set(self._containers)
        result = set([container])

        for container in result:
            deps = container.service.requires if self._forward \
                else container.service.needed_for
            deps = functools.reduce(lambda x, y: x.union(y),
                                    [s.containers for s in deps],
                                    set([]))
            result = result.union(deps.intersection(containers))

        result.remove(container)
        return result
Transitively gather all containers from the dependencies or
dataset/ETHPy150Open signalfx/maestro-ng/maestro/plays/__init__.py/BaseOrchestrationPlay._gather_dependencies