'Looks the key up in the caches.
Args:
key(tuple)
default: What is returned if key is not in the caches. If not
specified then function throws KeyError instead
callback(fn): Gets called when the entry in the cache is invalidated
update_metrics (bool): whether to update the cache hit rate metrics
Returns:
Either a Deferred or the raw result'

def get(self, key, default=_CacheSentinel, callback=None, update_metrics=True):

    callbacks = ([callback] if callback else [])
    val = self._pending_deferred_cache.get(key, _CacheSentinel)
    if (val is not _CacheSentinel):
        if (val.sequence == self.sequence):
            val.callbacks.update(callbacks)
            if update_metrics:
                self.metrics.inc_hits()
            return val.deferred
    val = self.cache.get(key, _CacheSentinel, callbacks=callbacks)
    if (val is not _CacheSentinel):
        self.metrics.inc_hits()
        return val
    if update_metrics:
        self.metrics.inc_misses()
    if (default is _CacheSentinel):
        raise KeyError()
    else:
        return default
