I jfinally managed to actually get to test the python script I mentioned in my question. It *does* work when asking to shut down as well.