'Instantiate the xblock fetching it either from the cache or from the structure
:param course_entry_override: the course_info with the course_key to use (defaults to cached)'

@contract(usage_key='BlockUsageLocator    |    BlockKey', course_entry_override='CourseEnvelope    |    None')
def _load_item(self, usage_key, course_entry_override=None, **kwargs):

    if isinstance(usage_key, BlockUsageLocator):
        course_key = usage_key.course_key
        if isinstance(usage_key.block_id, LocalId):
            try:
                return self.local_modules[usage_key]
            except KeyError:
                raise ItemNotFoundError
        else:
            block_key = BlockKey.from_usage_key(usage_key)
            version_guid = self.course_entry.course_key.version_guid
    else:
        block_key = usage_key
        course_info = (course_entry_override or self.course_entry)
        course_key = course_info.course_key
        version_guid = course_key.version_guid
    cached_module = self.modulestore.get_cached_block(course_key, version_guid, block_key)
    if cached_module:
        return cached_module
    block_data = self.get_module_data(block_key, course_key)
    class_ = self.load_block_type(block_data.block_type)
    block = self.xblock_from_json(class_, course_key, block_key, block_data, course_entry_override, **kwargs)
    block.course_version = version_guid
    self.modulestore.cache_block(course_key, version_guid, block_key, block)
    return block
