def _convert_bin_to_datelike_type(bins, dtype):
if is_datetime64tz_dtype(dtype):<EOL><INDENT>bins = to_datetime(bins.astype(np.int64),<EOL>utc=True).tz_convert(dtype.tz)<EOL><DEDENT>elif is_datetime_or_timedelta_dtype(dtype):<EOL><INDENT>bins = Index(bins.astype(np.int64), dtype=dtype)<EOL><DEDENT>return bins<EOL>
Convert bins to a DatetimeIndex or TimedeltaIndex if the orginal dtype is
datelike

Parameters
----------
bins : list-like of bins
dtype : dtype of data

Returns
-------
bins : Array-like of bins, DatetimeIndex or TimedeltaIndex if dtype is
       datelike