<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def paginate(self, page, per_page=20, error_out=True):
 """Returns ``per_page`` items from page ``page`` By default, it will abort with 404 if no items were found and the page was larger than 1. This behaviour can be disabled by setting ``error_out`` to ``False``. Returns a :class:`Pagination` object."""

        if page < 1 and error_out:
            abort(404)

        items = self.skip((page - 1) * per_page).limit(per_page).all()

        if len(items) < 1 and page != 1 and error_out:
            abort(404)

        return Pagination(self, page, per_page, self.count(), items)