'Create and enroll the user in the given course\'s and given mode.'

def create_and_enroll_user(self, username, password, course_id=None, mode=CourseMode.VERIFIED):

    if (course_id is None):
        course_id = self.course_key
    user = UserFactory.create(username=username, password=password)
    self.enroll(user, course_id, mode)
    return user
