def find_nearest(x, x0) -> Tuple[int, Any]:
    x = np.asanyarray(x)
    x0 = np.atleast_1d(x0)
    if x.size == 0 or x0.size == 0:
        raise ValueError('empty input(s)')
    if x0.ndim not in (0, 1):
        raise ValueError('2-D x0 not handled yet')
    ind = np.empty_like(x0, dtype=int)
    for i, xi in enumerate(x0):
        if xi is not None and (isinstance(xi, (datetime.datetime, datetime.date, np.datetime64)) or np.isfinite(xi)):
            ind[i] = np.nanargmin(abs(x-xi))
        else:
            raise ValueError('x0 must NOT be None or NaN to avoid surprising None return value')
    return ind.squeeze()[()], x[ind].squeeze()[()]