Section 36. Whoever, having knowledge of the commission of a felony, takes money, or a gratuity or reward, or an engagement therefor, upon an agreement or understanding, express or implied, to compound or conceal such felony, or not to prosecute therefor, or not to give evidence thereof, shall, if such crime is punishable with death or imprisonment in the state prison for life, be punished by imprisonment in the state prison for not more than five years or in jail for not more than one year; and if such crime is punishable in any other manner, by a fine of not more than five hundred dollars or by imprisonment in jail for not more than two years.