code: def _post_sync(self, data):
      dataset_name = data["datasetName"]
      stages = data["view"]
      patches_field = data[
          "patchesField"
      ]  # patches field of plot, or None
      selected_ids = data["selection"]  # selected IDs in plot
      slices = data["slices"]
  
      view = fosv.get_view(
          dataset_name,
          stages=stages,
          sample_filter=get_sample_filter(slices),
      )
  
      is_patches_view = view._is_patches
      is_patches_plot = patches_field is not None
  
      if not is_patches_view and not is_patches_plot:
          # Samples plot and samples view
          stage = fos.Select(selected_ids)
      elif is_patches_view and is_patches_plot:
          # Patches plot and patches view
          # Here we take advantage of the fact that sample IDs are equal to
          # patch IDs
          stage = fos.Select(selected_ids)
      elif is_patches_plot and not is_patches_view:
          # Patches plot and samples view
          stage = fos.MatchLabels(
              fields=[patches_field], ids=selected_ids
          )
      else:
          # Samples plot and patches view
          stage = fos.SelectBy("sample_id", selected_ids)
  
      d = stage._serialize(include_uuid=False)
      return {"_cls": d["_cls"], "kwargs": dict(d["kwargs"])}
  
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 1 for calling the EmbeddingsExtendedStage obj's underlying member method code with example usage: obj._post_sync(data) and returns: dict