def makeUserLibraryMap(libraries):
    """
    Given an interable set of libraries return a mapping or
    users interested in those libraries.
    """
    users = {}

    for library in libraries:
        for affiliation in library.affiliations.all():
            for user in affiliation.users.all():
                users.setdefault(user,[]).append(library)

    return users