def avg_ttm(df, years):
    """
    Calculate multi-year averages from TTM financial data, which has 4
    data-points per year, that each covers the Trailing Twelve Months.

    This is different from using a rolling average on TTM data, which
    over-weighs the most recent quarters in the average.

    This function should only be used on DataFrames for a single stock.
    Use `sf.apply` with this function on DataFrames for multiple stocks.

    :param df:
        Pandas DataFrame with TTM financial data sorted ascendingly by date.

    :param years:
        Integer for the number of years.

    :return:
        Pandas DataFrame with the averages.
    """

    # Start with the non-shifted data.
    df_result = df.copy()

    # Add shifted data for each year.
    for i in range(1, years):
        df_result += df.shift(4 * i)

    # Take the average.
    df_result /= years

    return df_result