code: 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
docs: Adapted from
          pandas.tseries.index.DatetimeIndex._maybe_cast_slice_bound