code: def _visit(self, L, marked, tempmarked):
          assert not self.is_pseudo
          if self in tempmarked:
              raise Exception('feature graph is cyclic')
          if self not in marked:
              tempmarked[self] = True
              features = list()
              if self.siblings is not None and self.is_toplevel:
                  features.extend(reversed(self.siblings))
              if self.children is not None:
                  features.extend(reversed(self.children))
              if len(features) > 0:
                  for feature in features:
                      feature._visit(L, marked, tempmarked)
              marked[self] = True
              del tempmarked[self]
              L.insert(0, self)