code: def get_tag_view(
      dataset: str,
      stages: t.List,
      filters: t.Dict,
      extended_stages: t.List = None,
      label_fields: t.List[str] = None,
      labels: t.Optional[t.List[t.Dict]] = None,
      hidden_labels: t.Optional[t.List[t.Dict]] = None,
      sample_filter: SampleFilter = None,
      target_labels: bool = False,
      sample_ids: t.List[str] = None,
  ) -> foc.SampleCollection:
      view = fosv.get_view(
          dataset,
          stages=stages,
          filters=filters,
          extended_stages=extended_stages,
          sample_filter=sample_filter,
      )
  
      if sample_ids:
          view = fov.make_optimized_select_view(
              view, sample_ids, flatten=True
          )
  
      if target_labels:
          if labels:
              view = view.select_labels(labels)
          elif hidden_labels:
              view = view.exclude_labels(hidden_labels)
          elif label_fields:
              view = view.select_fields(label_fields)
  
      return view
  
imports: import typing
  import fiftyone.core.collections
  import fiftyone.core.media
  import fiftyone.core.view
  from fiftyone.server.filters import SampleFilter
  import fiftyone.server.view
label_desc: Use image node_id 1 for calling a global function with example usage: get_tag_view(dataset, stages, filters, extended_stages, label_fields, labels, hidden_labels, sample_filter, target_labels, sample_ids) and returns: view