27. (1) If any person summoned as a witness be brought before a justice of the peace on a warrant issued in consequence of refusal to obey the summons, such person may be detained on such warrant before the justice of the peace who issued the summons, or before any other justice of the peace in and for the same territorial division, who shall then be there, or in a house of detention, or any other place of confinement, or in the custody of the person having him in charge, with a view to secure his presence as a witness on the day fixed for the trial; or, in the discretion of the justice of the peace, released on recognizance, with or without sureties, conditioned for his appearance to give evidence as therein mentioned, and to answer as for contempt for his default in not attending upon the said summons.
(2) The justice may, in a summary manner, examine into and dispose of the charge of contempt brought against such person, who, if found guilty, shall be liable to a fine of not more than $20, or to imprisonment in a house of detention, for a term of not more than one month, or to both such fine and imprisonment. He may also be ordered to pay the costs determined by regulation.
(3) The conviction under this section may be as in form 9.