Section 17. Whoever aids or assists a prisoner in escaping or attempting to escape from an officer or person who has the lawful custody of such prisoner shall be punished by a fine of not more than five hundred dollars or by imprisonment for not more than two years.