def find_node(node_name, g):
    """Go through the attributes and find the node with the given name"""
    for n, d in g.nodes_iter(data=True):
        if d["label"] == node_name:
            return n