Section 134. If a person who has received votes for any office at an election shall, within thirty days thereafter, himself or by his agent serve upon a city or town clerk a written claim to such office or a declaration of an intention to contest the election of any other person, the clerk shall retain the envelopes or containers containing the ballots for such office until such claim is withdrawn or the contest is determined. Any court of competent jurisdiction, or any body having jurisdiction under any constitution, statute, or charter to judge the elections or returns of its own members, may require the clerk to produce such envelopes or containers and ballots.