Use defusedxml's ParseError with Python 3