def METHOD_NAME(dtype, xp):
    dtype = xp.dtype(dtype)
    if dtype.kind in 'fc':
        return dtype
    if dtype in (xp.int8, xp.uint8):
        return xp.float16
    if dtype in (xp.int16, xp.uint16):
        return xp.float32
    return xp.float64