Returns a function that takes a dictionary and returns value of
    particular key. The returned value can be optionally processed by `mapper`
    function.

    To be used as a type hint in :class:`OneOf`.

def dict_value_hint(key, mapper=None):
    """Returns a function that takes a dictionary and returns value of
    particular key. The returned value can be optionally processed by `mapper`
    function.

    To be used as a type hint in :class:`OneOf`.
    """
    if mapper is None:
        mapper = identity

    def hinter(data):
        return mapper(data.get(key))

    return hinter