copy ktdtree.py