This removes the need for the use of the global statement. I've also updated the test that overrides this to use mock.patch instead of hand monkey patching.