def _fix_legend_duplicates(traces, layout):
    """Prevent repeat entries in the legend"""
    seen = set()
    for t in traces:
        key = (t.get('name'), t.get('marker', {}).get('color'))
        if key in seen:
            t['showlegend'] = False
        else:
            seen.add(key)
dataset/ETHPy150Open glue-viz/glue/glue/plugins/export_plotly.py/_fix_legend_duplicates/original