Improve the test for a valid root element.

We can't continue to use the `a = b or c` idiom here because a valid
root element ("b") has implicit `__nonzero__()` behavior based on its
`__len__()` method.  It's better to test directly for the `None`
sentinel value here.

In addition, lxml has deprecated the `__len__()` method on Elements,
so this code was indirectly producing a runtime warning.