Imprisonment or committal of person refusing to answer or produce document. If any witness or person called to produce a document or thing before a Criminal Court refuses to answer such questions as are put to him or to produce any document or thing in his possession or power which the Court requires him to produce, and does not, after a reasonable opportunity has been, given, to him so to do, offer any reasonable excuse for such refusal, such Court may, for reasons to be recorded in writing, sentence him to simple imprisonment, or by warrant under the hand of the Presiding Magistrate or Judge commit him to the custody of an officer of the Court for any term not exceeding seven days, unless in the meantime, such person consents to be examined and to answer, or to produce the document or thing and in the event of his persisting in his refusal, he may be dealt with according to the provisions of section 345 or section 346.