code: def _find_target_nodes(g):
      """Return nodes without successors"""
      ret = []
      for cn in g:
          cur_succ = list(g.successors(cn))
          if not cur_succ:
              ret.append(cn)
      return ret
  
imports: import networkx
  import collections
  import time
  import copy
  from caffe2.python import workspace, core
  from caffe2.proto import caffe2_pb2
  import enum
  import logging
  import caffe2.python._import_c_extension
label_desc: Use image node_id 6 for calling a global function with example usage: _find_target_nodes(g) and returns: ret