def METHOD_NAME(df, handling='fail'):
    if not df.index.is_unique:
        print("Duplicate entries:")
        display(df[df.index.duplicated(keep=False)].sort_values(by=df.index.names),
                pretty=False)
    assert df.index.is_unique or handling != 'fail'
    duplicated = (df.index.duplicated(keep='first') if handling == 'keep_first'
                  else df.index.duplicated(keep='last') if handling == 'keep_last'
                  else df.index.duplicated(keep=False) if handling == 'keep_none'
                  else np.full((len(df), 1), False))
    return df[~duplicated]