def get_extended_view(
    view,
    filters=None,
    extended_stages=None,
    pagination_data=False,
    media_types=None,
    sort_by=None,
    desc=None,
):
    """Create an extended view with the provided filters.

    Args:
        view: a :class:`fiftyone.core.collections.SampleCollection`
        filters: an optional ``dict`` of App defined filters
        extended_stages (None): extended view stages
        pagination_data (False): filters label data
        media_types (None): the media types to consider

    Returns:
        a :class:`fiftyone.core.view.DatasetView`
    """
    label_tags = None

    sort_by_stage = None
    if extended_stages:
        # extend view with similarity search, etc. first
        # omit sort_by, which happens last
        sort_by_stage = extended_stages.pop(
            "fiftyone.core.stages.SortBy", None
        )
        view = extend_view(view, extended_stages)

    if filters:
        if "tags" in filters:
            tags = filters.get("tags")
            exclude = tags["exclude"]
            tags = tags["values"]

            if tags and not exclude:
                view = view.match_tags(tags)

            if tags and exclude:
                view = view.match_tags(tags, bool=False)

        label_tags = filters.get(_LABEL_TAGS, None)
        if label_tags:
            view = _match_label_tags(view, label_tags)

        match_stage = _make_match_stage(view, filters)
        stages = []
        if match_stage:
            stages = [match_stage]

        stages.extend(_make_field_filter_stages(view, filters))
        stages.extend(_make_label_filter_stages(view, filters))

        for stage in stages:
            view = view.add_stage(stage)

    if sort_by_stage:
        view = extend_view(
            view, {"fiftyone.core.stages.SortBy": sort_by_stage}
        )

    if sort_by:
        view = view.sort_by(sort_by, reverse=bool(desc))

    if pagination_data:
        # omit all dict field values for performance, not needed by grid
        view = _project_pagination_paths(view, media_types)
        view = _add_labels_tags_counts(view)

    return view
Create an extended view with the provided filters.

    Args:
        view: a :class:`fiftyone.core.collections.SampleCollection`
        filters: an optional ``dict`` of App defined filters
        extended_stages (None): extended view stages
        pagination_data (False): filters label data
        media_types (None): the media types to consider

    Returns:
        a :class:`fiftyone.core.view.DatasetView`
    
fiftyone/server/view.py