code: def _add_to_trace(
      traces, style, points, id, sample_id, label, selected
  ):
      key = label if style == "categorical" else "points"
      if key not in traces:
          traces[key] = []
  
      traces[key].append(
          {
              "points": points,
              "id": id,
              "sample_id": sample_id or id,
              "label": label,
              "selected": selected,
          }
      )
  
imports: import itertools
  from starlette.endpoints import HTTPEndpoint
  from starlette.requests import Request
  import fiftyone.core.fields
  import fiftyone.core.stages
  from fiftyone.core.utils import run_sync_task
  from fiftyone.server.decorators import route
  import fiftyone.server.utils
  import fiftyone.server.view
  from fiftyone.server.filters import GroupElementFilter, SampleFilter
label_desc: Use image node_id 2 for calling a global function with example usage: _add_to_trace(traces, style, points, id, sample_id, label, selected) without return types