test_mach: move helper method out of global namespace