def _enroll_user_in_pending_courses(student):
 ceas = CourseEnrollmentAllowed.objects.filter(email=student.email)
 for cea in ceas:
  if cea.auto_enroll:
   enrollment = CourseEnrollment.enroll(student, cea.course_id)
   manual_enrollment_audit = ManualEnrollmentAudit.get_manual_enrollment_by_email(student.email)
   if (manual_enrollment_audit is not None):
    ManualEnrollmentAudit.create_manual_enrollment_audit(manual_enrollment_audit.enrolled_by, student.email, ALLOWEDTOENROLL_TO_ENROLLED, manual_enrollment_audit.reason, enrollment)

def _enroll_user_in_pending_courses ( student ) : ceas = CourseEnrollmentAllowed . objects . filter ( email = student . email ) for cea in ceas : if cea . auto_enroll : enrollment = CourseEnrollment . enroll ( student , cea . course_id ) manual_enrollment_audit = ManualEnrollmentAudit . get_manual_enrollment_by_email ( student . email ) if ( manual_enrollment_audit is not None ) : ManualEnrollmentAudit . create_manual_enrollment_audit ( manual_enrollment_audit . enrolled_by , student . email , ALLOWEDTOENROLL_TO_ENROLLED , manual_enrollment_audit . reason , enrollment )
enroll student in any pending courses he/she may have .