def validate_collection(sample_collection, media_type=None):
    """Validates that the provided samples are a
    :class:`fiftyone.core.collections.SampleCollection`.

    Args:
        sample_collection: a sample collection
        media_type (None): an optional media type or iterable of media types
            that the collection must have

    Raises:
        ValueError: if the provided samples are not a
        :class:`fiftyone.core.collections.SampleCollection`
    """
    if not isinstance(sample_collection, foc.SampleCollection):
        raise ValueError(
            "Expected samples to be a %s; found %s"
            % (foc.SampleCollection, sample_collection.__class__)
        )

    if etau.is_container(media_type):
        media_types = set(media_type)
        if sample_collection.media_type not in media_types:
            if sample_collection.media_type == fom.GROUP:
                raise fom.SelectGroupSlicesError(media_types)

            raise ValueError(
                "Expected a collection with media type in %s; found '%s'"
                % (media_types, sample_collection.media_type)
            )
    elif media_type is not None:
        if sample_collection.media_type != media_type:
            if sample_collection.media_type == fom.GROUP:
                raise fom.SelectGroupSlicesError(media_type)

            raise ValueError(
                "Expected a collection with media type '%s'; found '%s'"
                % (media_type, sample_collection.media_type)
            )
Validates that the provided samples are a
    :class:`fiftyone.core.collections.SampleCollection`.

    Args:
        sample_collection: a sample collection
        media_type (None): an optional media type or iterable of media types
            that the collection must have

    Raises:
        ValueError: if the provided samples are not a
        :class:`fiftyone.core.collections.SampleCollection`
    
fiftyone/core/validation.py