code: def _visit(self, func):
      fname = func[0]
      if fname in self._flags:
          if self._flags[fname] == 1:
              logger.critical("Fatal error! network ins not Dag.")
              import sys
  
              sys.exit(-1)
          else:
              return
      else:
          if fname not in self._flags:
              self._flags[fname] = 1
          for output in func[3]:
              for f in self._orig:
                  for input in f[2]:
                      if output == input:
                          self._visit(f)
  
      self._flags[fname] = 2
      self._sorted.insert(0, func)
  
file_path: nnabla/python/test/core/legacy_expander.py
imports: import collections
  import re
  from nnabla.utils import nnabla_pb2
label_desc: Use image node_id 2 for calling the _TopologicalSort obj's underlying member method code with example usage: obj._visit(func) without return types