code: def set_environment(self, environment):
          
          todo = deque([self])
          while todo:
              node = todo.popleft()
              node.environment = environment
              todo.extend(node.iter_child_nodes())
          return self
docs: Set the environment for all nodes.