def summarize_results(df, level='sample_name'):
    """ Summarize quality control results

    Args:
        df (pd.DataFrame): loaded using :func:`madic.io.read_transition_report`
        level (str): Choices: 'sample_name' or 'rep'
            Whether to return summary on a sample or replicate basis

    Returns:
        pd.DataFrame: DataFrame containing final pass / fail quality control
        results by peptide and sample
    """

    eval_cols = [x for x in df.columns if x.startswith('pass_')]

    summarized = df.groupby([
        level, 'pep'])[eval_cols].agg('all').reset_index()

    if 'interference' in df.columns:
        ic = df.groupby(['sample_name',
                         'pep']).interference.agg('any').reset_index()
        ic.rename(columns={'interference': 'interference_corrected'},
                  inplace=True)

        summarized = summarized.merge(ic)

    return summarized