def mapper(container):
    """Callable that returns the value for a given key
    in a dict-like container.

    The callable raises a ValueError if value not in the container.

    Parameters
    ----------
    container : dict-like object

    Returns
    -------
    callable (value) -> (value) might raise ValueError

    Examples
    -------
    >>> getter = mapper({'A': 42, 'B': 43})
    >>> getter('A')
    42
    >>> getter(0)
    Traceback (most recent call last):
    ...
    ValueError: 0 not in ('A', 'B')
    """

    def _inner(key):

        if key not in container:
            raise ValueError("{!r} not in {}".format(key, tuple(container.keys())))
        return container[key]

    return _inner