python script to generate tree topology