'Ensure a valid `course_key` was provided.'

def clean_course_key(self):

    course_key_string = self.cleaned_data['course_key']
    try:
        return CourseKey.from_string(course_key_string)
    except InvalidKeyError:
        raise ValidationError("'{}'    is    not    a    valid    course    key.".format(unicode(course_key_string)))
