def strip(self, how: str = "all") -> Self:
        """
        Return a ``TimeSeries`` slice of this deterministic time series, where NaN-containing entries at the beginning
        and the end of the series are removed. No entries after (and including) the first non-NaN entry and
        before (and including) the last non-NaN entry are removed.

        This method is only applicable to deterministic series (i.e., having 1 sample).

        Parameters
        ----------
        how
            Define if the entries containing `NaN` in all the components ('all') or in any of the components ('any')
            should be stripped. Default: 'all'

        Returns
        -------
        TimeSeries
            a new series based on the original where NaN-containing entries at start and end have been removed
        """
        raise_if(
            self.is_probabilistic,
            "`strip` cannot be applied to stochastic TimeSeries",
            logger,
        )

        first_finite_row, last_finite_row = _finite_rows_boundaries(
            self.values(), how=how
        )

        return self.__class__.from_times_and_values(
            times=self.time_index[first_finite_row : last_finite_row + 1],
            values=self.values()[first_finite_row : last_finite_row + 1],
            columns=self.components,
            static_covariates=self.static_covariates,
            hierarchy=self.hierarchy,
            metadata=self.metadata,
        )

        Return a ``TimeSeries`` slice of this deterministic time series, where NaN-containing entries at the beginning
        and the end of the series are removed. No entries after (and including) the first non-NaN entry and
        before (and including) the last non-NaN entry are removed.

        This method is only applicable to deterministic series (i.e., having 1 sample).

        Parameters
        ----------
        how
            Define if the entries containing `NaN` in all the components ('all') or in any of the components ('any')
            should be stripped. Default: 'all'

        Returns
        -------
        TimeSeries
            a new series based on the original where NaN-containing entries at start and end have been removed
        
darts/timeseries.py