def METHOD_NAME(arg_dtype, query_fn, sycl_dev):
    res_dt = query_fn(arg_dtype)
    if res_dt:
        return None, res_dt
    _fp16 = sycl_dev.has_aspect_fp16
    _fp64 = sycl_dev.has_aspect_fp64
    all_dts = _all_data_types(_fp16, _fp64)
    for buf_dt in all_dts:
        if _can_cast(arg_dtype, buf_dt, _fp16, _fp64):
            res_dt = query_fn(buf_dt)
            if res_dt:
                return buf_dt, res_dt
    return None, None