def make_badge_dict(badges, profiles):
    """Make a dict of files and their badges."""
    badge_dict = dict()

    for badge, profile in zip(badges, profiles):
        for filename in profile["files"]:
            if filename in badge_dict:
                entry = badge_dict[filename]
                entry.append(badge)

            else:
                badge_dict[filename] = [badge]

    return badge_dict