def subst(**kwargs):
    """Returns a function which applies the character substitution table in kwargs on its input."""
    def func(target: str):
        return "".join((
            kwargs.get(char, char) for char in target
        ))
    return func