@staticmethod
def common_length(ts1, ts2):
    """
        This function trims the lengths of two timeseries and returns two
        timeseries with the same length.

        The idea is that in order to do array operations there must be a
        common length for each timeseries.

        Reflecting the bias for using timeseries sorted from latest info to
        earlier info, truncation takes place at the end of the array. That
        way older less important values are removed if necessary.

        Usage:
            ts1_new, ts2_new = self.common_length(ts1, ts2)

        """
    length1 = len(ts1.tseries)
    length2 = len(ts2.tseries)
    if length1 == length2:
        return ts1.clone(), ts2.clone()
    else:
        length = min(length1, length2)
        return ts1[:length], ts2[:length]
