def _maybe_cast_slice_bound(self, label, side, kind):
        """Adapted from
        pandas.tseries.index.DatetimeIndex._maybe_cast_slice_bound"""
        if isinstance(label, str):
            parsed, resolution = _parse_iso8601_with_reso(self.date_type,
                                                          label)
            start, end = _parsed_string_to_bounds(self.date_type, resolution,
                                                  parsed)
            if self.is_monotonic_decreasing and len(self) > 1:
                return end if side == 'left' else start
            return start if side == 'left' else end
        else:
            return label
def _maybe_cast_slice_bound ( self , label , side , kind ) : if isinstance ( label , str ) : parsed , resolution = _parse_iso8601_with_reso ( self . date_type , label ) start , end = _parsed_string_to_bounds ( self . date_type , resolution , parsed ) if self . is_monotonic_decreasing and len ( self ) > 1 : return end if side == 'left' else start return start if side == 'left' else end else : return label
Adapted from
        pandas.tseries.index.DatetimeIndex._maybe_cast_slice_bound