def _filter_for_overlap(df1, df2, cols, leaders):
    """
    Returns overlapping model/scenario combinations in the two input dataframes, which
    must have the same columns.
    Parameters
    ----------
    df1 : :obj:`pd.DataFrame`
        The first dataframe (order is irrelevant)
    df2 : :obj:`pd.DataFrame`
        The second dataframe (order is irrelevant)
    cols: list[str]
        List of columns that should be identical between the two dataframes. Typically
        "scenario", "model", and whatever the time column is.
    leaders : list[str]
        List of lead variables that must be found in all acceptable model/scenarios
        combinations.
    Returns
    -------
    (:obj:`pd.DataFrame`, :obj:`pd.DataFrame`)
        The two dataframes in the order they were put in, now filtered for some columns
        being identical.
    """
    lead_data = df1.data.set_index(cols)
    follow_data = df2.data.set_index(cols)
    # We only want to select model/scenario cases where we have data for all leaders

    shared_indices = lead_data.index[
        lead_data.index.isin(follow_data.index)
    ].value_counts()
    shared_indices = shared_indices[shared_indices == len(leaders)].index.tolist()

    if not shared_indices:
        raise ValueError("No model/scenario overlap between leader and follower data")

    lead_data = lead_data.loc[shared_indices]
    follow_data = follow_data.loc[shared_indices]
    return lead_data.reset_index(), follow_data.reset_index()