code: def _post_sync(self, data):
      dataset_name = data["datasetName"]
      brain_key = data["brainKey"]
      stages = data["view"]
      filters = data["filters"]
      slices = data["slices"]
      extended_stages = data["extended"]
      extended_selection = data["extendedSelection"]
  
      if not filters and not extended_stages and not extended_selection:
          return {"selected": None}
  
      dataset = fosu.load_and_cache_dataset(dataset_name)
      results = dataset.load_brain_results(brain_key)
  
      view = fosv.get_view(
          dataset_name,
          stages=stages,
          sample_filter=get_sample_filter(slices),
      )
      if view.view() != results.view.view():
          results.use_view(view, allow_missing=True)
  
      patches_field = results.config.patches_field
      is_patches_plot = patches_field is not None
  
      if is_patches_plot:
          ids = results._curr_label_ids
      else:
          ids = results._curr_sample_ids
  
      if filters or extended_stages:
          extended_view = fosv.get_view(
              dataset_name,
              stages=stages,
              filters=filters,
              extended_stages=extended_stages,
              sample_filter=get_sample_filter(slices),
          )
          is_patches_view = extended_view._is_patches
  
          if is_patches_plot and not is_patches_view:
              _, id_path = extended_view._get_label_field_path(
                  patches_field, "id"
              )
              extended_ids = extended_view.values(id_path, unwind=True)
          elif is_patches_view and not is_patches_plot:
              extended_ids = extended_view.values("sample_id")
          else:
              extended_ids = extended_view.values("id")
  
          selected_ids = set(ids) & set(extended_ids)
      else:
          selected_ids = None
  
      if extended_selection is not None:
          if selected_ids:
              selected_ids &= set(extended_selection)
          else:
              selected_ids = set(extended_selection)
  
      return {"selected": selected_ids}
  
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 EmbeddingsSelection obj's underlying member method code with example usage: obj._post_sync(data) and returns: dict, dict