def pad(
            self,
            start_pad: Optional[float] = None,
            end_pad: Optional[float] = None,
            max_dur: Optional[float] = None,
            max_end: Optional[float] = None,
            word_level: bool = False
    ) -> "WhisperResult":
        """
        Pad (in-place) timestamps in chronological order.

        Parameters
        ----------
        start_pad : float, optional
            Seconds to pad start timestamps.
            Each start timestamp will be extended no earlier than the end timestamp of the previous word.
        end_pad : float, optional
            Seconds to pad end timestamps.
            Each end timestamp will be extended no later than the start timestamp of the next word or ``max_end``.
        max_dur : float, optional
            Only pad segments or words (``word_level=True``) with duration (in seconds) under or equal to ``max_dur``.
        max_end : float, optional
            Timestamp (in seconds) that padded timestamps cannot exceed.
            Generally used to prevent the last padded end timestamp from exceeding the total duration of the audio.
        word_level : bool, default False
            Whether to pad segment timestamps or word timestamps.

        Returns
        -------
        stable_whisper.result.WhisperResult
            The current instance after the changes.
        """
        if not (start_pad or end_pad):
            warnings.warn(f'No ``start_pad`` or ``end_pad`` given.',
                          stacklevel=2)
            return self
        if word_level and not self.has_words:
            word_level = False
        parts = self.all_words() if word_level else self.segments
        assert not start_pad or start_pad > 0, '``start_pad`` must be positive'
        assert not end_pad or end_pad > 0, '``end_pad`` must be positive'
        assert max_dur is None or max_dur > 0, '``max_dur`` must be greater than 0'
        assert max_end is None or max_end > 0, '``max_end`` must be greater than 0'
        for i, part in enumerate(parts, 1):
            if max_dur and part.end - part.start > max_dur:
                continue
            if start_pad:
                new_start = part.start - start_pad
                new_start = max(0 if i == 1 else parts[i-2].end, new_start)
                part.start = new_start
            if end_pad:
                new_end = part.end + end_pad
                temp_max_end = max_end
                if i != len(parts):
                    temp_max_end = min(max_end, parts[i].start) if max_end else parts[i].start
                if temp_max_end and temp_max_end < new_end:
                    new_end = temp_max_end
                if new_end > part.end:
                    part.end = new_end

        self._update_history(
            f'p={start_pad or ""}+{end_pad or ""}+{max_dur or ""}+{max_end or ""}+{int(word_level)}'
        )
        return self

        Pad (in-place) timestamps in chronological order.

        Parameters
        ----------
        start_pad : float, optional
            Seconds to pad start timestamps.
            Each start timestamp will be extended no earlier than the end timestamp of the previous word.
        end_pad : float, optional
            Seconds to pad end timestamps.
            Each end timestamp will be extended no later than the start timestamp of the next word or ``max_end``.
        max_dur : float, optional
            Only pad segments or words (``word_level=True``) with duration (in seconds) under or equal to ``max_dur``.
        max_end : float, optional
            Timestamp (in seconds) that padded timestamps cannot exceed.
            Generally used to prevent the last padded end timestamp from exceeding the total duration of the audio.
        word_level : bool, default False
            Whether to pad segment timestamps or word timestamps.

        Returns
        -------
        stable_whisper.result.WhisperResult
            The current instance after the changes.
        
stable_whisper/result.py