def last(self):
        """Returns the last sample in the dataset.

        Returns:
            a :class:`fiftyone.core.sample.Sample`
        """
        try:
            sample_view = self[-1:].first()
        except ValueError:
            raise ValueError("%s is empty" % self.__class__.__name__)

        return fos.Sample.from_doc(sample_view._doc, dataset=self)
Returns the last sample in the dataset.

        Returns:
            a :class:`fiftyone.core.sample.Sample`
        
fiftyone/core/dataset.py