def get_course_enrollments(user):
 enrollments = CourseEnrollment.enrollments_for_user(user)
 course_org = configuration_helpers.get_value('course_org_filter')
 if course_org:
  site_enrollments = [enrollment for enrollment in enrollments if (enrollment.course_id.org == course_org)]
 else:
  site_enrollments = [enrollment for enrollment in enrollments]
 return site_enrollments

def get_course_enrollments ( user ) : enrollments = CourseEnrollment . enrollments_for_user ( user ) course_org = configuration_helpers . get_value ( 'course_org_filter' ) if course_org : site_enrollments = [ enrollment for enrollment in enrollments if ( enrollment . course_id . org == course_org ) ] else : site_enrollments = [ enrollment for enrollment in enrollments ] return site_enrollments
returns the course enrollments for the passed in user within the context of current org .