def last(self, count=1):
        """
        Returns the last record in the query (sorting by id unless modified by
        `order_by`, whereupon it reverses the order passed in `order_by`).
        Returns None if the query has no records.
        """
        if self._order_with:
            order = self._order_with.values()[0]
            order = "desc" if order == "asc" else "asc"
            order_with = self._order_with
            self._order_with = {}
            result = self.order_by(**{order_with.keys()[0]: order}).first(count)
            self._order_with = order_with
            return result
        else:
            return self.order_by(id="desc").first(count)