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.
Ca. Veh. Code § 12951