from pathlib import Path


def _downloads_iter(config_bundle):
    """Iterator for the downloads ordered by output path"""
    return sorted(
        map(lambda x: (x, config_bundle.downloads[x]), config_bundle.downloads),
        key=(lambda x: str(Path(x[1].output_path))))