Syntax error in Python_Steiner tree

I’ve posted a possible solution in your other thread here.