def filter_images(candidates):
    """Return only images -- i.e. remove audio files etc."""
    filtered_candidates = {}
    for c in candidates:
        if 'imageinfo' not in c or not c['imageinfo']:
            print("Missing imageinfo:", c)
            continue
        if c['imageinfo'][0]['mime'].startswith('image'):
            filtered_candidates[c['pageid']] = c
    return filtered_candidates