Return the mode that provides a given product

def iterate_mode_provides(self, modes, pipeline):
        """Return the mode that provides a given product"""

        for mode_key, mode in modes.items():
            try:
                recipe = pipeline.get_recipe_object(mode_key)
                for key, provide in recipe.products().items():
                    if provide.type.isproduct():
                        yield provide.type, mode, key
            except KeyError:
                warnings.warn('Mode {} has not recipe'.format(mode_key))