def from_union(type_check_fn_lst: list[Callable[[Any], Any]], x: Any) -> Any:
    """Assert `x` is either of the types."""
    for f in type_check_fn_lst:
        try:
            return f(x)
        except:
            pass
    assert False
Assert `x` is either of the types.
preprocess/src/data_types/utils.py