Return key's value if it exists, otherwise call given function.

        :param key: The key to lookup/set.
        :param func: A function to use if the key doesn't exist.

        All other arguments and keyword arguments are passed to *func*.

def set(self, key, func, *args, **kwargs):
        """Return key's value if it exists, otherwise call given function.

        :param key: The key to lookup/set.
        :param func: A function to use if the key doesn't exist.

        All other arguments and keyword arguments are passed to *func*.

        """
        if key in self:
            return self[key]
        self[key] = value = func(*args, **kwargs)
        return value