def read_kwargs_from_dict(input_dict, type_dict):
    """ Reads, from an input dictionary, a set of keyword arguments.
    This function is useful to gather optional arguments for a function call
    from a greater, more complete, input dictionary. For this purpose,
    keys that are not found at input_dict are simply ignored.

    The desired keywords mus be the keys of type_dict, whose values
    must be the type cast callable. None can be passed as a type cast
    for no conversion.

    Parameters
    ------
    input_dict : dict
        Dictionary with the input keywords. Can contain more than the
        necessary keywords.
    type_dict : dict
        Dictionary with the desired names as keys and their type casts
        as values. Type can be None for no conversion.
    """
    kwargs = dict()

    for key, cast in type_dict.items():
        try:
            if cast is None:
                kwargs[key] = input_dict[key]
            else:
                kwargs[key] = cast(input_dict[key])
        except KeyError:
            pass

    return kwargs