def str2var(s, variables):
    """Try to match string `s` to one of the `Var`s in `variables`."""
    for variable in variables:
        if s == str(variable):
            return variable
    raise ValueError(s)
