def validate_image_sample(sample):
    """Validates that the sample's media is an image.

    Args:
        sample: a :class:`fiftyone.core.sample.Sample`

    Raises:
        ValueError if the sample's media is not an image
    """
    if sample.media_type != fom.IMAGE:
        raise ValueError(
            "Expected media type '%s' but found '%s' for filepath '%s'"
            % (fom.IMAGE, sample.media_type, sample.filepath)
        )

    if isinstance(sample, fov.FrameView):
        _validate_image(sample.filepath)
Validates that the sample's media is an image.

    Args:
        sample: a :class:`fiftyone.core.sample.Sample`

    Raises:
        ValueError if the sample's media is not an image
    
fiftyone/core/validation.py