def last(self):
        """
        Returns the last object of a query, returns None if no match is found.
        """
        qs = self.reverse() if self.ordered else self.order_by('-pk')
        try:
            return qs[0]
        except __HOLE__:
            return None
dataset/ETHPy150Open ulule/django-courriers/courriers/core.py/QuerySet.last