Any vacancy in any elective town office, except the board of education, from whatever cause arising, shall be filled by appointment by the town council for the unexpired portion of the term or until the next biennial election, whichever shall be sooner; provided that when the person vacating the office shall have been elected as a member of a political party, such vacancy shall be filled by the appointment of a member of the same political party, upon nomination by a council member of the same political party, if any. Any vacancy on the board of education shall be filled within ninety days from its occurrence by appointment by the board of education for the unexpired portion of the term or until the next biennial election, whichever shall be sooner; provided that when the person vacating the office shall have been elected as a member of a political party, such vacancy shall be filled by the appointment of a member of the same political party upon nomination by a board of education member of the same political party, if any. Upon the failure of the board of education to fill said vacancy, it shall be filled by appointment by the council in the same manner as hereinabove set forth. If there shall be a biennial town election before the expiration of the term of any office in which a vacancy occurs, such office shall be filled until said election by appointment as provided herein, and subsequently by the election of a person to fill that office for the remaining portion of the term, and such person shall take office upon election.