add python version of same-tree