Refactoring python script to create Jenkins XML test report