def indexed_images_relationship_match(data, indices, synset_matches):
    """
    For each image in the data matched with with indices, see if there is a synset_match
    data - relationship json
    indices - indices of images that we are interested in (in the first use case
              these are humans / persons)
    synset_matches - callable, outputs whether sysnset matches some top level synset
    """

    index_matches = []

    for i in indices:
        for rel in data[i]:
            for syn in rel['subject']['synsets'] + rel['object']['synsets']:
                if synset_matches(syn):
                    index_matches.append((i, rel['relationship_id']))

    return index_matches