import collections
followers_that_friends_follow = collections.defaultdict(list)
for f in friends:
    ff = api.GetFriendsIDs(f)['ids']
users = followers_not_friends.intersection(ff)
for user in users:
    followers_that_friends_follow[user].append(f)
Showing what Twitter followers are followed by friends in Python/Django