code: 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 ``samples`` is 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)
              )
  
file_path: fiftyone/fiftyone/core/validation.py
imports: import eta.core.utils
  import fiftyone.core.media
  import fiftyone.core.utils
label_desc: Use image node_id 3 for calling a global function with example usage: validate_collection(sample_collection, media_type) without return types