def clean_expired(self):
        session = self._session_maker()
        try:
            found = False
            for expired_data in session.query(PostReservationRetrievedData).filter(PostReservationRetrievedData.expiration_date < self.time_provider.get_datetime()).all():
                session.delete(expired_data)
                found = True

            if found:
                try:
                    session.commit()
                except (ConcurrentModificationError, IntegrityError):
                    # Somebody else did it
                    traceback.print_exc()
        finally:
            session.close()
dataset/ETHPy150Open weblabdeusto/weblabdeusto/server/src/weblab/core/coordinator/sql/post_reservation.py/PostReservationDataManager.clean_expired/original