<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def invert(self):
 """Inverts the DFA final states"""

        for state in self.states:
            if state.final:
                state.final = False
            else:
                state.final = True