def select_most_recent_belief(df: 'classes.BeliefsDataFrame'
    ) ->'classes.BeliefsDataFrame':
    """Drop all but most recent belief."""
    if 'belief_horizon' in df.index.names:
        return df.groupby(level=['event_start', 'source'], group_keys=False
            ).apply(lambda x: x.xs(min(x.lineage.belief_horizons), level=
            'belief_horizon', drop_level=False))
    elif 'belief_time' in df.index.names:
        return df.groupby(level=['event_start', 'source'], group_keys=False
            ).apply(lambda x: x.xs(max(x.lineage.belief_times), level=
            'belief_time', drop_level=False))
    else:
        raise KeyError(
            'No belief_horizon or belief_time index level found in DataFrame.')
