Python Build Tree From List