Return the (sub)tree type: 'root', 'nucleus', 'satellite', 'text' or 'leaf'

    Parameters
    ----------
    tree : nltk.tree.ParentedTree
        a tree representing a rhetorical structure (or a part of it)

def get_tree_type(tree):
    """Return the (sub)tree type: 'root', 'nucleus', 'satellite', 'text' or 'leaf'

    Parameters
    ----------
    tree : nltk.tree.ParentedTree
        a tree representing a rhetorical structure (or a part of it)
    """
    if is_leaf_node(tree):
        return SubtreeType.leaf

    tree_type = tree.label().lower().split(':')[0]
    assert tree_type in SUBTREE_TYPES
    return tree_type