def gatherSubNodesD( nodes, output=None ):
    """ gather all nodes into a flat list - depth-first """
    output = [] if output is None else output
    if not isinstance( nodes, list ):
        nodes = [ nodes ]
    for node in nodes:
        output.append( node )
        for child_node in node.children:
            gatherSubNodesD( child_node, output )
    return output