code: def extract_subgraph(root, stop_nodes=set()):
      """Copies the TF graph structure into something more pythonic."""
      result = [root]
      for input in root.op.inputs:
          if input in stop_nodes:
              result.append((input,))
          else:
              result.append(extract_subgraph(input, stop_nodes))
      return tuple(result)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import edward.inferences.conjugacy.conjugate_log_probs
  import numpy
  import six
  import tensorflow
  import time
  from collections import defaultdict
  from edward.inferences.conjugacy.simplify import symbolic_suff_stat, full_simplify, expr_contains, reconstruct_expr
  from edward.models.random_variables import *
  from edward.util import copy, get_blanket
label_desc: Use image node_id 7 for calling a global function with example usage: extract_subgraph(root, stop_nodes) and returns: tuple