'Returns the course_id of the course if it was found, else None
Args:
course_id (CourseKey):
ignore_case (boolean): some modulestores are case-insensitive. Use this flag
to search for whether a potentially conflicting course exists in that case.'

def has_course(self, course_id, ignore_case=False, **kwargs):

    assert isinstance(course_id, CourseKey)
    if ignore_case:
        return next((c.id for c in self.get_courses() if ((c.id.org.lower() == course_id.org.lower()) and (c.id.course.lower() == course_id.course.lower()) and (c.id.run.lower() == course_id.run.lower()))), None)
    else:
        return next((c.id for c in self.get_courses() if (c.id == course_id)), None)
