'Fetch a given key from the cache. If the key does not exist,
add the key and set it to the default value. The default value can
also be any callable. If timeout is given, use that timeout for the
key; otherwise use the default cache timeout.
Return the value of the key stored or retrieved.'

def get_or_set(self, key, default, timeout=DEFAULT_TIMEOUT, version=None):

    val = self.get(key, version=version)
    if ((val is None) and (default is not None)):
        if callable(default):
            default = default()
        self.add(key, default, timeout=timeout, version=version)
        return self.get(key, default, version=version)
    return val
