def memoize(func):
    """A decorator to cache the return value of func.

    Args:
        func: function to decorate

    Returns:
        wrapper: decorated function
    """
    cache = {}

    def wrapper(args):
        try:
            return cache[args]
        except KeyError:
            cache[args] = func(args)
            return cache[args]
    return wrapper