def to_id_priority_tuple_pairs(
        feature_segments: typing.Union[  # type: ignore[type-arg]
            typing.Iterable["FeatureSegment"], typing.Iterable[dict]
        ],
    ) -> typing.List[typing.Tuple[int, int]]:
        """
        Helper method to convert a collection of FeatureSegment objects or dictionaries to a list of 2-tuples
        consisting of the id, priority of the feature segments.
        """
        id_priority_pairs = []
        for fs in feature_segments:
            if isinstance(fs, dict):
                id_priority_pairs.append((fs["id"], fs["priority"]))
            else:
                id_priority_pairs.append((fs.id, fs.priority))

        return id_priority_pairs

        Helper method to convert a collection of FeatureSegment objects or dictionaries to a list of 2-tuples
        consisting of the id, priority of the feature segments.
        
api/features/models.py