code: def expand(self, local_search=False):
          '''Create successors.'''
          new_nodes = []
          for action in self.problem.actions(self.state):
              new_state = self.problem.result(self.state, action)
              cost = self.problem.cost(self.state,
                                       action,
                                       new_state)
              nodefactory = self.__class__
              new_nodes.append(nodefactory(state=new_state,
                                           parent=None if local_search else self,
                                           problem=self.problem,
                                           action=action,
                                           cost=self.cost + cost,
                                           depth=self.depth + 1))
          return new_nodef expand(self, local_search=False):
          '''Create successors.'''
          new_nodes = []
          for action in self.problem.actions(self.state):
              new_state = self.problem.result(self.state, action)
              cost = self.problem.cost(self.state,
                                       action,
                                       new_state)
              nodefactory = self.__class__
              new_nodes.append(nodefactory(state=new_state,
                                           parent=None if local_search else self,
                                           problem=self.problem,
                                           action=action,
                                           cost=self.cost + cost,
                                           depth=self.depth + 1))
          return new_nodes
docs: Create successors.