Fix import errors with ElementTree.ParseError, move methods outside of the class