(a)
Whenever a witness in any proceeding before or ancillary to any court or grand jury of the United States refuses without just cause shown to comply with an order of the court to testify or provide other information, including any book, paper, document, record, recording or other material, the court, upon such refusal, or when such refusal is duly brought to its attention, may summarily order his confinement at a suitable place until such time as the witness is willing to give such testimony or provide such information. No period of such confinement shall exceed the life of—
(1)
the court proceeding, or
(2)
the term of the grand jury, including extensions,
before which such refusal to comply with the court order occurred, but in no event shall such confinement exceed eighteen months.