Generates all containers' dependencies, i.e. an iterator on tuples in the format
        ``(container_name, used_containers)``, whereas the used containers are a set, and can be empty.

        :return: Container dependencies.
        :rtype: collections.Iterable

def dependency_items(self):
        """
        Generates all containers' dependencies, i.e. an iterator on tuples in the format
        ``(container_name, used_containers)``, whereas the used containers are a set, and can be empty.

        :return: Container dependencies.
        :rtype: collections.Iterable
        """
        def _get_used_items_np(u):
            volume_config_name, __, volume_instance = u.name.partition('.')
            attaching_config_name = attaching.get(volume_config_name)
            if attaching_config_name:
                used_c_name = attaching_config_name
                used_instances = instances.get(attaching_config_name)
            else:
                used_c_name = volume_config_name
                if volume_instance:
                    used_instances = (volume_instance, )
                else:
                    used_instances = instances.get(volume_config_name)
            return [MapConfigId(ItemType.CONTAINER, self._name, used_c_name, ai)
                    for ai in used_instances or (None, )]

        def _get_used_items_ap(u):
            volume_config_name, __, volume_instance = u.name.partition('.')
            attaching_config = ext_map.get_existing(volume_config_name)
            attaching_instances = instances.get(volume_config_name)
            config_volumes = {a.name for a in attaching_config.attaches}
            if not volume_instance or volume_instance in config_volumes:
                used_instances = attaching_instances
            else:
                used_instances = (volume_instance, )
            return [MapConfigId(ItemType.CONTAINER, self._name, volume_config_name, ai)
                    for ai in used_instances or (None, )]

        def _get_linked_items(lc):
            linked_config_name, __, linked_instance = lc.partition('.')
            if linked_instance:
                linked_instances = (linked_instance, )
            else:
                linked_instances = instances.get(linked_config_name)
            return [MapConfigId(ItemType.CONTAINER, self._name, linked_config_name, li)
                    for li in linked_instances or (None, )]

        def _get_network_mode_items(n):
            net_config_name, net_instance = n
            network_ref_config = ext_map.get_existing(net_config_name)
            if network_ref_config:
                if net_instance and net_instance in network_ref_config.instances:
                    network_instances = (net_instance, )
                else:
                    network_instances = network_ref_config.instances or (None, )
                return [MapConfigId(ItemType.CONTAINER, self._name, net_config_name, ni)
                        for ni in network_instances]
            return []

        def _get_network_items(n):
            if n.network_name in DEFAULT_PRESET_NETWORKS:
                return []
            net_items = [MapConfigId(ItemType.NETWORK, self._name, n.network_name)]
            if n.links:
                net_items.extend(itertools.chain.from_iterable(_get_linked_items(l.container) for l in n.links))
            return net_items

        if self._extended:
            ext_map = self
        else:
            ext_map = self.get_extended_map()

        instances = {c_name: c_config.instances
                     for c_name, c_config in ext_map}
        if not self.use_attached_parent_name:
            attaching = {attaches.name: c_name
                         for c_name, c_config in ext_map
                         for attaches in c_config.attaches}
            used_func = _get_used_items_np
        else:
            used_func = _get_used_items_ap

        def _get_dep_list(name, config):
            image, tag = self.get_image(config.image or name)
            d = []
            nw = config.network_mode
            if isinstance(nw, tuple):
                merge_list(d, _get_network_mode_items(nw))
            merge_list(d, itertools.chain.from_iterable(map(_get_network_items, config.networks)))
            merge_list(d, itertools.chain.from_iterable(map(used_func, config.uses)))
            merge_list(d, itertools.chain.from_iterable(_get_linked_items(l.container) for l in config.links))
            d.extend(MapConfigId(ItemType.VOLUME, self._name, name, a.name)
                     for a in config.attaches)
            d.append(MapConfigId(ItemType.IMAGE, self._name, image, tag))
            return d

        for c_name, c_config in ext_map:
            dep_list = _get_dep_list(c_name, c_config)
            for c_instance in c_config.instances or (None, ):
                yield MapConfigId(ItemType.CONTAINER, self._name, c_name, c_instance), dep_list