'Load a component from the cache, if it exists. Returns the component, if found, and the cache key.'

def __get_cached_component(self, component_name, model_metadata):

    from rasa_nlu import registry
    from rasa_nlu.model import Metadata
    component_class = registry.get_component_class(component_name)
    cache_key = component_class.cache_key(model_metadata)
    if ((cache_key is not None) and self.use_cache and (cache_key in self.component_cache)):
        return (self.component_cache[cache_key], cache_key)
    else:
        return (None, cache_key)
