'Update the db record for course_index.
Arguments:
from_index: If set, only update an index if it matches the one specified in `from_index`.'

def update_course_index(self, course_index, from_index=None, course_context=None):

    with TIMER.timer('update_course_index', course_context):
        if from_index:
            query = {'_id': from_index['_id']}
            if ('last_update' in from_index):
                query['last_update'] = from_index['last_update']
        else:
            query = {'org': course_index['org'], 'course': course_index['course'], 'run': course_index['run']}
        course_index['last_update'] = datetime.datetime.now(pytz.utc)
        self.course_index.update(query, course_index, upsert=False)
