"If any person assaults an officer of the court while in the execution of his duty, he shall be liable- .... (b) on an order made by the judge on that behalf to be committed for a specified period not exceeding 3 months to prison, to such a fine as aforesaid, or to be so committed and to such fine...."