Section 71. The board of aldermen of a city or the selectmen of a town, on petition executed in accordance with the by-laws or a vote of the directors of a company whose tracks are located in said city or town, or on petition of any interested party, after public notice and a hearing as provided in section seven, may alter the location of the tracks in the manner prescribed in, and subject to, the preceding section. Such alteration shall be made by such company within such time, and the expense thereof shall be borne by such parties and in such proportions, as the board of aldermen or selectmen may determine. No such alteration of a location shall be valid, until the department, after public notice and a hearing, shall certify that such alteration is consistent with the public interest. If the department requires an amendment to such alteration before so certifying, it shall notify the board of aldermen or selectmen of such amendment; and thereafter the board of aldermen or selectmen may amend such alteration in accordance with the said amendment; provided, that, if the amendment involves a change in the route of the railway, public notice and a hearing shall be given as provided in the case of the original application for an alteration; and thereafter the department may, as a part of the original proceedings before it, certify that such alteration so amended is consistent with the public interest. An alteration, so certified, shall be a valid location, if, within sixty days after the issue of notice of said certification to the company, it files a written acceptance of such alteration, executed in accordance with its by-laws or a vote of its directors, with the board of aldermen or selectmen.