The supreme court, by a justice within the judicial district, or the county court, by a county judge within his county, may direct the examination by any candidate or his agent of any ballot or voting machine upon which his name appeared, and the preservation of any ballots in view of a prospective contest, upon such conditions as may be proper.
N.Y. Elec.Law § 16-112