It would be better to not call `get_children` twice. Also, `any` called on an empty generator expression is `False`, so you don't need to validate that `get_children` returns a non-empty list.