def METHOD_NAME(value: typing.Any, type_: type) -> typing.Any:
    """
    Similar to `safe_cast` but will raise an exception if
    casting is unsuccessful.
    Parameters
    ----------
    value : Any
        The candidate value to attempt to cast
    type_ : Any
        The target type to attempt to cast value to
    Returns
    -------
    Any
        Cast value
    Raises
    ------
    TypeError
        If the candidate value could not be cast to target type.
    """
    cast_value, error = safe_cast(value, type_)
    if error is not None:
        raise TypeError("Cannot cast {} to {}: {}".format(value, type_.__name__, error))
    return cast_value