def get_series_seq_type(
    ts: Union[TimeSeries, Sequence[TimeSeries], Sequence[Sequence[TimeSeries]]],
) -> SeriesType:
    """Returns the sequence type of `ts`.

    - SeriesType.SINGLE: `TimeSeries` (e.g. a single series)
    - SeriesType.SEQ: sequence of `TimeSeries` (e.g. multiple series)
    - SeriesType.SEQ_SEQ: sequence of sequences of `TimeSeries` (e.g. historical forecasts output)

    Parameters
    ----------
    ts
        The input series to get the sequence type from.

    Raises
    ------
    ValueError
        If `ts` does not have one of the expected sequence types.
    """
    if ts is None:
        return SeriesType.NONE
    elif isinstance(ts, TimeSeries):
        return SeriesType.SINGLE
    elif isinstance(ts[0], TimeSeries):
        return SeriesType.SEQ
    else:
        try:
            if isinstance(ts[0][0], TimeSeries):
                return SeriesType.SEQ_SEQ
            else:
                raise_log(
                    ValueError(
                        "input series must be of type `TimeSeries`, `Sequence[TimeSeries]`, or "
                        "`Sequence[Sequence[TimeSeries]]`."
                    ),
                    logger=logger,
                )
        except Exception as err:
            raise_log(
                ValueError(
                    "input series must be of type `TimeSeries`, `Sequence[TimeSeries]`, or "
                    f"`Sequence[Sequence[TimeSeries]]`. Raised: `{type(err).__name__}('{str(err)}')`"
                ),
                logger=logger,
            )
Returns the sequence type of `ts`.

    - SeriesType.SINGLE: `TimeSeries` (e.g. a single series)
    - SeriesType.SEQ: sequence of `TimeSeries` (e.g. multiple series)
    - SeriesType.SEQ_SEQ: sequence of sequences of `TimeSeries` (e.g. historical forecasts output)

    Parameters
    ----------
    ts
        The input series to get the sequence type from.

    Raises
    ------
    ValueError
        If `ts` does not have one of the expected sequence types.
    
darts/utils/ts_utils.py