def METHOD_NAME(tool: Union[BaseTool, BaseTool2]) -> CURRENT_BASETOOL:
    """
    Given an instance of a tool-info module's class, return an instance that conforms to
    the current API. Might be either the same or a different instance.
    """
    if isinstance(tool, BaseTool2):
        return tool
    elif isinstance(tool, BaseTool):
        return cast(BaseTool2, Tool1To2(tool))  # ptype does not support @register yet
    else:
        raise TypeError(
            f"{tool.__class__} is not a subclass of one of the expected base classes "
            f"in benchexec.tools.template"
        )