def getbranches(tree):
 if isinstance(tree, tuple):
  (name, subtree) = tree
  a = [name]
  for st in subtree:
   a.extend(getbranches(st))
  return a
 return []

def getbranches ( tree ) : if isinstance ( tree , tuple ) : ( name , subtree ) = tree a = [ name ] for st in subtree : a . extend ( getbranches ( st ) ) return a return [ ]
walk tree to get list of branches parameters tree : list of tuples tree as defined for ru2nmnl returns branch : list list of all branch names .