The test is in the statute; it's in subsection 540(8). The judge would have to be convinced that the inspection of those election documents would be useful for instituting a prosecution of an offence and/or for purposes of a contested election. So the test is very limited. It would have to be demonstrated to the court.
On May 16th, 2006. See this statement in context.