Section 163. If the mayor, aldermen or board of selectmen determines, after notice to parties interested and a hearing, the identity of the owner or keeper of a dog which is found to have worried, maimed or killed livestock or fowl, thereby causing damages for which the owner of the livestock or fowl may become entitled to compensation from the city or town under section 161, the mayor, aldermen or selectmen shall serve upon the owner or keeper of such dog a notice directing the owner or keeper, within 24 hours, to euthanize the dog in a humane manner or restrain the dog.