Check that a dtype, if passed, represents either a numpy datetime64[ns]
    dtype or a pandas DatetimeTZDtype.

    Parameters
    ----------
    dtype : object

    Returns
    -------
    dtype : None, numpy.dtype, or DatetimeTZDtype

    Raises
    ------
    ValueError : invalid dtype

    Notes
    -----
    Unlike validate_tz_from_dtype, this does _not_ allow non-existent
    tz errors to go through

def _validate_dt64_dtype(dtype):
    """
    Check that a dtype, if passed, represents either a numpy datetime64[ns]
    dtype or a pandas DatetimeTZDtype.

    Parameters
    ----------
    dtype : object

    Returns
    -------
    dtype : None, numpy.dtype, or DatetimeTZDtype

    Raises
    ------
    ValueError : invalid dtype

    Notes
    -----
    Unlike validate_tz_from_dtype, this does _not_ allow non-existent
    tz errors to go through
    """
    if dtype is not None:
        dtype = pandas_dtype(dtype)
        if is_dtype_equal(dtype, np.dtype("M8")):
            # no precision, warn
            dtype = _NS_DTYPE
            msg = textwrap.dedent("""\
                Passing in 'datetime64' dtype with no precision is deprecated
                and will raise in a future version. Please pass in
                'datetime64[ns]' instead.""")
            warnings.warn(msg, FutureWarning, stacklevel=5)

        if ((isinstance(dtype, np.dtype) and dtype != _NS_DTYPE)
                or not isinstance(dtype, (np.dtype, DatetimeTZDtype))):
            raise ValueError("Unexpected value for 'dtype': '{dtype}'. "
                             "Must be 'datetime64[ns]' or DatetimeTZDtype'."
                             .format(dtype=dtype))
    return dtype