Fix the ending spaces removing rule
Add rule for removing all spaces in some elements
Compatible with Python 3
Add some test cases