Section 171. The owner or keeper of a dog which has done damage to livestock or fowl shall be liable in tort to the city or town for all damages so done which the mayor, aldermen or board of selectmen have ordered to be paid as provided in this chapter.