'Internal generator for fetching lists of courses, libraries, etc.
:param str branch: Branch to fetch structures from
:param type locator_factory: Factory to create locator from structure info and branch'

def _get_structures_for_branch_and_locator(self, branch, locator_factory, **kwargs):

    result = []
    for (entry, structure_info) in self._get_structures_for_branch(branch, **kwargs):
        locator = locator_factory(structure_info, branch)
        envelope = CourseEnvelope(locator, entry)
        root = entry['root']
        structures_list = self._load_items(envelope, [root], depth=0, **kwargs)
        if (not isinstance(structures_list[0], ErrorDescriptor)):
            result.append(structures_list[0])
    return result
