ARMORY-201 Python Code Refactoring