def _remove_objects_paired_with(df, bad_pairs):
    """
    Remove any objects that are paired with an object in ``bad_pairs``

    This is done in place
    """
    assert df.index.name == 'sort_i'
    df.reset_index(inplace=True)
    df.set_index('sort_j', inplace=True)
    try:
        bad_pair_index = df.index.intersection(bad_pairs).unique()
        to_drop = df.loc[bad_pair_index]['sort_i'].values
        df.reset_index(inplace=True)
        df.set_index('sort_i', inplace=True)
        df.drop(to_drop, inplace=True)
    except:
        df.set_index('sort_i', inplace=True)
