Every officer having the custody of any record, map, or book, or of any paper or proceeding of any court, filed or deposited in any public office, or placed in his or her hands for any purpose, is punishable by imprisonment pursuant to subdivision (h) of Section 1170 of the Penal Code for two, three, or four years if, as to the whole or any part of the record, map, book, paper, or proceeding, the officer willfully does or permits any other person to do any of the following: