code: def tree2bracket(docgraph, root=None, successors=None):
      
      if root is None:
          root = docgraph.root
      if successors is None:
          successors = sorted_bfs_successors(docgraph, root)
  
      if root in successors:
          embed_str = u" ".join(tree2bracket(docgraph, child, successors)
                                for child in successors[root])
          return node2bracket(docgraph, root, embed_str)
      return node2bracket(docgraph, root)
docs: convert a docgraph into a PTB-style string.
  
      If root (a node ID) is given, only convert the subgraph that this
      node domintes/spans into a PTB-style string.