def get(self, key, delete_if_expired=True):
self._update_cache_stats(key, None)<EOL>if key in self._CACHE:<EOL><INDENT>(expiration, obj) = self._CACHE[key]<EOL>if expiration > self._now():<EOL><INDENT>self._update_cache_stats(key, '<STR_LIT>')<EOL>return obj<EOL><DEDENT>else:<EOL><INDENT>if delete_if_expired:<EOL><INDENT>self.delete(key)<EOL>self._update_cache_stats(key, '<STR_LIT>')<EOL>return None<EOL><DEDENT><DEDENT><DEDENT>self._update_cache_stats(key, '<STR_LIT>')<EOL>return None<EOL>
Retrieve key from Cache.

:param key: key to look up in cache.
:type key: ``object``

:param delete_if_expired: remove value from cache if it is expired.
                          Default is True.
:type delete_if_expired: ``bool``

:returns: value from cache or None
:rtype: varies or None