from typing import Callable
from typing import Dict
from typing import Any


def memoized(func: Callable) -> Callable:
    """Decorator that caches values returned by a function for future calls.

    The first time func is called with a particular sequence of arguments, the
    result is computed as normal. Any subsequent calls to func with the same
    sequence of arguments will then return the same value without requiring it
    to be recomputed.
    """

    memo: Dict[Any, Any] = {}

    def memo_func(*args: Any) -> Any:
        if args not in memo:
            memo[args] = func(*args)
        return memo[args]

    return memo_func