human
Complete the below
def enrolled_students_features(course_key, features):

    ''''Return list of student features as dictionaries.
    enrolled_students_features(course_key, [\'username\', \'first_name\'])
    would return [
    {\'username\': \'username1\', \'first_name\': \'firstname1\'}
    {\'username\': \'username2\', \'first_name\': \'firstname2\'}
    {\'username\': \'username3\', \'first_name\': \'firstname3\'}'
    '''
assistant
#Here is the Python program you requested.
    include_cohort_column = ('cohort' in features)
    include_team_column = ('team' in features)
    include_enrollment_mode = ('enrollment_mode' in features)
    include_verification_status = ('verification_status' in features)
    students = User.objects.filter(courseenrollment__course_id=course_key, courseenrollment__is_active=1).order_by('username').select_related('profile')
    if include_cohort_column:
        students = students.prefetch_related('course_groups')
    if include_team_column:
        students = students.prefetch_related('teams')
    def extract_attr(student, feature):
        'Evaluate    a    student    attribute    that    is    ready    for    JSON    serialization'
        attr = getattr(student, feature)
        try:
            DjangoJSONEncoder().default(attr)
            return attr
        except TypeError:
            return unicode(attr)
    def extract_student(student, features):
        '    convert    student    to    dictionary    '
        student_features = [x for x in STUDENT_FEATURES if (x in features)]
        profile_features = [x for x in PROFILE_FEATURES if (x in features)]
        meta_features = []
        for feature in features:
            if ('meta.' in feature):
                meta_key = feature.split('.')[1]
                meta_features.append((feature, meta_key))
        student_dict = dict(((feature, extract_attr(student, feature)) for feature in student_features))
        profile = student.profile
        if (profile is not None):
            profile_dict = dict(((feature, extract_attr(profile, feature)) for feature in profile_features))
            student_dict.update(profile_dict)
            meta_dict = (json.loads(profile.meta) if profile.meta else {})
            for (meta_feature, meta_key) in meta_features:
                student_dict[meta_feature] = meta_dict.get(meta_key)
        if include_cohort_column:
            student_dict['cohort'] = next((cohort.name for cohort in student.course_groups.all() if (cohort.course_id == course_key)),...