<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def handle_database_error(cls, session, exception):
 """Rollback changes made and handle any type of error raised by the DBMS."""


        session.rollback()

        if isinstance(exception, IntegrityError):
            cls.handle_integrity_error(exception)
        elif isinstance(exception, FlushError):
            cls.handle_flush_error(exception)
        else:
            raise exception