def KaplanMeier(data, termination):
    """
    get Kaplan Meier survival curve for a given set of data

    Parameters
    ----------
    data : pandas dataframe
        the dataframe in wide format as created by :py:func:`.wide_format`

    termination : string
        the termination transition (most commonly death) that we want to base the curve on

    Returns
    ----------
    list
        a two-element list with:

        - first element a list of age-specific survival proportions (points on a Kaplan-Meier curve)
        - second element the area under the curve (ie life expectancy)

    """
    curve = []
    s = 1
    for n in range(0, int(data['final age'].max() + 1)):
        curve.append(s)
        D = len(data[(data[termination + "_age"] == n) & (data[termination + '_status'] == 1)])
        N = len(data[(data['final age'] >= n - 1)])
        s *= (N - D) / N
    total = 0
    for i in range(0, len(curve)):
        total += curve[i]
    return [curve, total]