Section 12. The city council of a city or the selectmen of a town may, for the purpose of determining whether a canal or waterway within the limits of the city or town is dangerous to the public, give a public hearing thereon, after notice in writing, to the person owning, operating or controlling said canal or waterway, and if after such hearing the council or selectmen shall adjudge said canal or waterway to be dangerous to the public, they shall order that a suitable fence be erected along said canal or waterway or any portion thereof. The person so ordered to erect the fence may within thirty days after written notice of said order, appeal therefrom to the department of highways, which shall thereupon give due notice and hear all parties interested, and its decision thereon shall be final.