Section 4. Whoever, after the commission of a felony, harbors, conceals, maintains or assists the principal felon or accessory before the fact, or gives such offender any other aid, knowing that he has committed a felony or has been accessory thereto before the fact, with intent that he shall avoid or escape detention, arrest, trial or punishment, shall be an accessory after the fact, and, except as otherwise provided, be punished by imprisonment in the state prison for not more than seven years or in jail for not more than two and one half years or by a fine of not more than one thousand dollars. The fact that the defendant is the husband or wife, or by consanguinity, affinity or adoption, the parent or grandparent, child or grandchild, brother or sister of the offender, shall be a defence to a prosecution under this section. If such a defendant testifies solely as to the existence of such relationship, he shall not be subject to cross examination on any other subject matter, nor shall his criminal record, if any, except for perjury or subornation of perjury, be admissible to impeach his credibility.