<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def execute(self, statements, exc=IntegrityError, rasie_as=ValueError):
 """Execute ``statements`` in a session, and perform a rollback on error. ``exc`` is a single exception object or a tuple of objects to be used in the except clause. The error message is re-raised as the exception specified by ``raise_as``. """


        Session = sessionmaker(bind=self.engine)
        session = Session()

        try:
            for statement in statements:
                session.execute(statement)
        except exc as err:
            session.rollback()
            raise rasie_as(str(err))
        else:
            session.commit()
        finally:
            session.close()