'Returns a CoursewareEnrollment object.
Args:
user (User): The user associated with the enrollment.
course_id (CourseKey): The key of the course associated with the enrollment.
Returns:
Course enrollment object or None'

@classmethod
def get_enrollment(cls, user, course_key):

    assert user
    if user.is_anonymous():
        return None
    try:
        return cls.objects.get(user=user, course_id=course_key)
    except cls.DoesNotExist:
        return None
