Section 27. Whoever, not being entitled to vote under the laws relative to absent voting, votes or attempts to vote thereunder or whoever being entitled to vote under said laws knowingly votes or attempts to vote in violation thereof shall be punished by a fine of not more than ten thousand dollars and by imprisonment for not more than five years.