Porting quadtree into python