A rash of party switching has flipped several state legislatures