(a)
The licensee shall have the valid driver’s license issued to him or her in his or her immediate possession at all times when driving a motor vehicle upon a highway.
Any charge under this subdivision shall be dismissed when the person charged produces in court a driver’s license duly issued to that person and valid at the time of his or her arrest, except that upon a third or subsequent charge the court in its discretion may dismiss the charge. When a temporary, interim, or duplicate driver’s license is produced in court, the charge shall not be dismissed unless the court has been furnished proof by the Department of Motor Vehicles that the temporary, interim, or duplicate license was issued prior to the arrest, that the driving privilege and license had not been suspended or revoked, and that the person was eligible for the temporary, interim, or duplicate license.
(b)
The driver of a motor vehicle shall present his or her license for examination upon demand of a peace officer enforcing the provisions of this code.