def is_empty(self):
    """Returns True if this node has no children, or if all of its children are ParseNode instances
    and are empty.
    """
    return all(isinstance(c, ParseNode) and c.is_empty for c in self.children)
Returns True if this node has no children, or if all of its children are ParseNode instances
    and are empty.