Ensure to be node.

    If ``node`` is string, convert it to ``Text`` node.

def _ensure_node(node: Union[str, AbstractNode]) -> AbstractNode:
    """Ensure to be node.

    If ``node`` is string, convert it to ``Text`` node.
    """
    if isinstance(node, str):
        return Text(node)
    elif isinstance(node, Node):
        return node
    else:
        raise TypeError('Invalid type to append: {}'.format(node))