Move code for generating_trees, copying trees and replacing_subtrees to node.py