def labels(self, leaves=True, internal=True):
        '''Generator over the (non-``None``) ``Node`` labels of this ``Tree``

        Args:
            ``leaves`` (``bool``): ``True`` to include leaves, otherwise ``False``

            ``internal`` (``bool``): ``True`` to include internal nodes, otherwise ``False``
        '''
        if not isinstance(leaves, bool):
            raise TypeError("leaves must be a bool")
        if not isinstance(internal, bool):
            raise TypeError("internal must be a bool")
        for node in self.traverse_preorder():
            if node.label is not None and ((leaves and node.is_leaf()) or (internal and not node.is_leaf())):
                yield node.label
def labels ( self , leaves = True , internal = True ) : if not isinstance ( leaves , bool ) : raise TypeError ( "leaves must be a bool" ) if not isinstance ( internal , bool ) : raise TypeError ( "internal must be a bool" ) for node in self . traverse_preorder ( ) : if node . label is not None and ( ( leaves and node . is_leaf ( ) ) or ( internal and not node . is_leaf ( ) ) ) : yield node . label
Generator over the (non-``None``) ``Node`` labels of this ``Tree``

        Args:
            ``leaves`` (``bool``): ``True`` to include leaves, otherwise ``False``

            ``internal`` (``bool``): ``True`` to include internal nodes, otherwise ``False``