def makeFileTree(rootFile, remainingDepth, tempFileTree):  
    tree = ET.Element("tree")
    tree.attrib["count"] = "0"
    children = ET.SubElement(tree, "children")
    if remainingDepth > 0:
        for i in xrange(random.choice(xrange(1, 10))):
            childFile = tempFileTree.getTempFile()
            ET.SubElement(children, "child", { "file":childFile })
            makeFileTree(childFile, remainingDepth-1, tempFileTree)
    fileHandle = open(rootFile, 'w')
    ET.ElementTree(tree).write(fileHandle)
    fileHandle.close()
Makes a random tree of linked files.
dataset/ETHPy150Open benedictpaten/jobTree/test/scriptTreeTest_Wrapper.py/makeFileTree