def filter_stream(self, stream_info):
        """Filters this object to contain only frame labels specified in the
        given stream info

        Args:
            stream_info: the :class:`OpenLABELStreamInfo` to use to filter this
                object

        Returns:
            an :class:`OpenLABELObject` containing only frames related to the
            given stream info
        """
        # if obj is top level and stream info is sample level
        if stream_info.is_streamless:
            if self.is_frame_level or not self.is_streamless:
                return None

            # This object is sample-level and streamless
            return self

        if stream_info.is_sample_level:
            return self

        return self._keep_frames(stream_info.frame_numbers)
Filters this object to contain only frame labels specified in the
        given stream info

        Args:
            stream_info: the :class:`OpenLABELStreamInfo` to use to filter this
                object

        Returns:
            an :class:`OpenLABELObject` containing only frames related to the
            given stream info
        
fiftyone/utils/openlabel.py