You could just always use the logic in the first section. `get_courses` is implemented by `XMLModuleStore` as well as by the mongo stores.