'Validates the course_key that would be used by maintenance app views.
Arguments:
course_key (string): a course key
branch: a course locator branch, default value is ModuleStoreEnum.BranchName.draft .
values can be either ModuleStoreEnum.BranchName.draft or ModuleStoreEnum.BranchName.published.
Returns:
course_usage_key (CourseLocator): course usage locator'

def validate_course_key(self, course_key, branch=ModuleStoreEnum.BranchName.draft):

    if (not course_key):
        raise ValidationError(COURSE_KEY_ERROR_MESSAGES['empty_course_key'])
    course_usage_key = CourseKey.from_string(course_key)
    if (not modulestore().has_course(course_usage_key)):
        raise ItemNotFoundError(COURSE_KEY_ERROR_MESSAGES['course_key_not_found'])
    course_usage_key = course_usage_key.for_branch(branch)
    return course_usage_key
