docs: def write_graphml(docgraph, output_file):
      """
      takes a document graph, converts it into GraphML format and writes it to
      a file.
      """
      dg_copy = deepcopy(docgraph)
      layerset2str(dg_copy)
      attriblist2str(dg_copy)
      remove_root_metadata(dg_copy)
      nx_write_graphml(dg_copy, output_file)