(1) If any person asks to be excused from attending or testifying or from producing any books, papers, records, contracts, documents, or other evidence in connection with any examination, hearing, or investigation being conducted by the director, his deputy or examiner, or in any proceeding or action before any court or magistrate upon a charge of violation of this code, on the ground that the testimony or evidence required of him may tend to incriminate him or subject him to a penalty or forfeiture, and shall notwithstanding be directed to give such testimony or produce such evidence, he must, if so directed by the director and the attorney general, nonetheless comply with such direction; and he shall not be exempt from the refusal, suspension, or revocation of any license, permission, or authority conferred, or to be conferred, pursuant to this code. After complying, and if, but for this section, he would have been privileged to withhold the answer given or the evidence produced by him, the answer given, or evidence produced, and any information directly or indirectly derived from the answer or evidence, may not be used against the compelled person in any manner in a criminal case, except that he may nevertheless be prosecuted or subjected to penalty or forfeiture for any perjury, false swearing or contempt committed in answering or failing to answer, or in producing or failing to produce, evidence in accordance with the order.
(2)  Any such individual may execute, acknowledge and file in the department a statement expressly waiving such immunity or privilege in respect to any transaction, matter or thing specified in such statement, and thereupon the testimony of such individual or such evidence in relation to such transaction, matter, or thing may be received or produced before any judge or justice, court, tribunal, magistrate, grand jury or otherwise, and if so received or produced such individual shall not be entitled to any immunity or privileges on account of any testimony he may so give or evidence so produced.