def _concat_static_covs(series: Sequence[TimeSeries]) -> Optional[pd.DataFrame]:
    """Concatenates static covariates along component dimension (rows of static covariates). For stacking or
    concatenating TimeSeries along component dimension (axis=1).

    Some context for stacking or concatenating two or more TimeSeries with static covariates:
        Concat along axis=0 (time)
            Along time dimension, we only take the static covariates of the first series (as static covariates are
            time-independent).
        Concat along axis=1 (components) or stacking
            Along component dimension, we either concatenate or transfer the static covariates of the series if one
            of below cases applies:
            1)  concatenate along component dimension (rows of static covariates) when for each series the number of
                static covariate components is equal to the number of components in the series. The static variable
                names (columns in series.static_covariates) must be identical across all series
            2)  if only the first series contains static covariates transfer only those
            3)  if `ignore_static_covarites=True` (with `concatenate()`), case 1) is ignored and only the static
                covariates of the first series are transferred
        Concat along axis=2 (samples)
            Along sample dimension, we only take the static covariates of the first series (as we components and
            time don't change).
    """

    if not any([ts.has_static_covariates for ts in series]):
        return None

    only_first = series[0].has_static_covariates and not any([
        ts.has_static_covariates for ts in series[1:]
    ])
    all_have = all([ts.has_static_covariates for ts in series])

    raise_if_not(
        only_first or all_have,
        "Either none, only the first or all TimeSeries must have `static_covariates`.",
        logger,
    )

    if only_first:
        return series[0].static_covariates

    raise_if_not(
        all([len(ts.static_covariates) == ts.n_components for ts in series])
        and all([
            ts.static_covariates.columns.equals(series[0].static_covariates.columns)
            for ts in series
        ]),
        "Concatenation of multiple TimeSeries with static covariates requires all `static_covariates` "
        "DataFrames to have identical columns (static variable names), and the number of each TimeSeries' "
        "components must match the number of corresponding static covariate components (the number of rows "
        "in `series.static_covariates`).",
        logger,
    )

    return pd.concat(
        [ts.static_covariates for ts in series if ts.has_static_covariates], axis=0
    )
Concatenates static covariates along component dimension (rows of static covariates). For stacking or
    concatenating TimeSeries along component dimension (axis=1).

    Some context for stacking or concatenating two or more TimeSeries with static covariates:
        Concat along axis=0 (time)
            Along time dimension, we only take the static covariates of the first series (as static covariates are
            time-independent).
        Concat along axis=1 (components) or stacking
            Along component dimension, we either concatenate or transfer the static covariates of the series if one
            of below cases applies:
            1)  concatenate along component dimension (rows of static covariates) when for each series the number of
                static covariate components is equal to the number of components in the series. The static variable
                names (columns in series.static_covariates) must be identical across all series
            2)  if only the first series contains static covariates transfer only those
            3)  if `ignore_static_covarites=True` (with `concatenate()`), case 1) is ignored and only the static
                covariates of the first series are transferred
        Concat along axis=2 (samples)
            Along sample dimension, we only take the static covariates of the first series (as we components and
            time don't change).
    
darts/timeseries.py