from typing import Any


def convert(value: str, type_: type) -> Any:
    """Convert string `value` to type `type_`."""
    if type_ is bool:
        return value.lower() in ("1", "t", "true", "y", "yes")
    return type_(value)