'Find the course_indexes which have the specified branch. if `kwargs` contains `org`
to apply an ORG filter to return only the courses that are part of that ORG. Extract `version_guids`
from the course_indexes.'

def collect_ids_from_matching_indexes(self, branch, **kwargs):

    matching_indexes = self.find_matching_course_indexes(branch, search_targets=None, org_target=kwargs.get('org'))
    version_guids = []
    id_version_map = defaultdict(list)
    for course_index in matching_indexes:
        version_guid = course_index['versions'][branch]
        version_guids.append(version_guid)
        id_version_map[version_guid].append(course_index)
    return (version_guids, id_version_map)
