Section 15. In a prosecution before a district court under the by-laws, ordinances, orders, rules or regulations of a city or town, the city solicitor, town counsel or other person appointed to represent such city or town may enter a nolle prosequi or do anything relative to such prosecution which may be done by the district attorney.