human
Complete this python program:
def coerce_types(**kwargs):
assistant
#Here is the Python code you requested.

    """Preprocessing decorator that applies type coercions.
    Parameters
    **kwargs : dict[str -> (type, callable)]
    Keyword arguments mapping function parameter names to pairs of
    (from_type, to_type).
    Examples
    >>> @coerce_types(x=(float, int), y=(int, str))
    ... def func(x, y):
    ...     return (x, y)
    >>> func(1.0, 3)
    (1, \3\)
    """
    def _coerce(types):
        return coerce(*types)
    return preprocess(**valmap(_coerce, kwargs))