typecasts all `layers` from sets of strings into a single string to make
    the graph exportable (e.g. into the `gexf` and `graphml` formats).

    Parameters
    ----------
    discoursegraph : DiscourseDocumentGraph

def layerset2str(discoursegraph):
    """
    typecasts all `layers` from sets of strings into a single string to make
    the graph exportable (e.g. into the `gexf` and `graphml` formats).

    Parameters
    ----------
    discoursegraph : DiscourseDocumentGraph
    """
    for node_id in discoursegraph:
        discoursegraph.node[node_id]['layers'] = \
            str(discoursegraph.node[node_id]['layers'])
    for (from_id, to_id) in discoursegraph.edges_iter():
        # there might be multiple edges between 2 nodes
        edge_dict = discoursegraph.edge[from_id][to_id]
        for edge_id in edge_dict:
            edge_dict[edge_id]['layers'] = \
                str(edge_dict[edge_id]['layers'])