def __nonzero__(self):
        """Returns 1 if the tree is nonempty, 0 otherwise."""
        try:
            self.__cargo
            return 1
        except AttributeError:
            return 0
Returns 1 if the tree is nonempty, 0 otherwise.
recipes/Python/136529_Trees_and_more_trees/recipe-136529.py