'Get the enrollment mode for a given course on the dashboard.
Arguments:
course_name (str): The name of the course whose mode should be retrieved.
Returns:
String, indicating the enrollment mode for the course corresponding to
the provided course name.
Raises:
Exception, if no course with the provided name is found on the dashboard.'

def get_enrollment_mode(self, course_name):

    course_listing = self.q(css='.course').filter((lambda el: (course_name in el.text))).results
    if course_listing:
        enrollment_mode = course_listing[0].get_attribute('class').split('course    ')[1]
    else:
        raise Exception('No    course    named    {}    was    found    on    the    dashboard'.format(course_name))
    return enrollment_mode
