code: def retain_period_common_to_all(
      series: List[TimeSeries],
  ) -> List[TimeSeries]:
      """
      Trims all series in the provided list, if necessary, so that the returned time series have
      a common span (corresponding to largest time sub-interval common to all series).
  
      Parameters
      ----------
      series
          The list of series to consider.
  
      Raises
      ------
      ValueError
          If no common time sub-interval exists
  
      Returns
      -------
      List[TimeSeries]
          A list of series, where each series have the same span
      """
  
      last_first = max(map(lambda s: s.start_time(), series))
      first_last = min(map(lambda s: s.end_time(), series))
  
      if last_first >= first_last:
          raise_log(
              ValueError(
                  "The provided time series must have nonzero overlap"
              ),
              logger,
          )
  
      return list(
          map(lambda s: s.slice(last_first, first_last), series)
      )
  
imports: from enum import Enum
  from functools import wraps
  from inspect import Parameter, getcallargs, signature
  from typing import Callable, Iterator, List, Optional, Sequence, Tuple, TypeVar, Union
  import pandas
  from joblib import Parallel, delayed
  from tqdm import tqdm
  from tqdm.notebook import tqdm
  from darts import TimeSeries
  from darts.logging import get_logger, raise_if_not, raise_log
  from darts.utils.timeseries_generation import generate_index
label_desc: Use image node_id 1 for calling a global function with example usage: retain_period_common_to_all(series) and returns: list