'If the course_key identifies a course and points to its draft (or plausibly its draft),
then return the index entry.
raises VersionConflictError if not the right version
:param course_key: a CourseLocator
:param force: if false, raises VersionConflictError if the current head of the course != the one identified
by course_key'

def _get_index_if_valid(self, course_key, force=False):

    if ((course_key.org is None) or (course_key.course is None) or (course_key.run is None) or (course_key.branch is None)):
        return None
    else:
        index_entry = self.get_course_index(course_key)
        is_head = ((course_key.version_guid is None) or (index_entry['versions'][course_key.branch] == course_key.version_guid))
        if (is_head or force):
            return index_entry
        else:
            raise VersionConflictError(course_key, index_entry['versions'][course_key.branch])
