def METHOD_NAME(arg_name, arg_spec, arg_torch):
    if isinstance(arg_spec, _spec.Tensor):
        if not isinstance(arg_torch, torch.Tensor):
            raise TypeError(
                f"Expected argument `{arg_name}` to be `torch.Tensor`, "
                f"but got {type(arg_torch)}"
            )
        return core._from_dlpack(arg_torch)  # pylint: disable=protected-access
    if isinstance(arg_spec, _spec.Int):
        if not isinstance(arg_torch, int):
            raise TypeError(
                f"Expected argument `{arg_name}` to be `int`, but got {type(arg_torch)}"
            )
        return ShapeTuple([arg_torch])
    raise TypeError(f"Unsupported spec item type: {type(arg_spec)}")