code: def tees_parse_networkx_to_dot(G, output_file, subgraph_nodes):
      
  
      with codecs.open(output_file, 'w', encoding='utf-8') as f:
          f.write('digraph teesParse {\n')
  
          mentioned_nodes = set()
  
          for from_node in subgraph_nodes:
              for edge in G.edges(from_node):
                  to_node = edge[1]
  
                  mentioned_nodes.add(from_node)
                  mentioned_nodes.add(to_node)
                  relation = G.edges[from_node, to_node]['relation']
                  f.write('%s -> %s [ label = "%s" ];\n' % (from_node, to_node,
                          relation))
  
          for node in mentioned_nodes:
              is_event = G.node[node]['is_event']
              if is_event:
                  node_type = G.node[node]['type']
                  negated = G.node[node]['negated']
                  speculation = G.node[node]['speculation']
  
                  # Add a tag to the label if the event is negated or speculation
                  if negated and speculation:
                      tag = ' {NS}'
                  elif negated:
                      tag = ' {N}'
                  elif speculation:
                      tag = ' {S}'
                  else:
                      tag = ''
  
                  node_label = node_type + tag
              else:
                  node_label = G.node[node]['text']
              f.write('%s [label="%s"];\n' % (node, node_label))
  
          f.write('}\n')
docs: Converts TEES extractions stored in a networkx graph into a graphviz
      .dot file.
  
      Parameters
      ----------
      G : networkx.DiGraph
          Graph with TEES extractions returned by run_and_parse_tees
      output_file : str
          Output file to which to write .dot file
      subgraph_nodes : list[str]
          Only convert the connected graph that includes these ndoes