<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_flush_error(cls, exception):
 """Handle flush error exceptions."""


        trace = exception.args[0]
        m = re.match(cls.MYSQL_FLUSH_ERROR_REGEX, trace)

        if not m:
            raise exception

        entity = m.group('entity')
        eid = m.group('eid')

        raise AlreadyExistsError(entity=entity, eid=eid)