def get_nodes(G, key, value):
    """Return list of nodes that has attribute key = value"""
    result_nodes = []
    for node in G.nodes:
        if G.node[node].get(key) == value:
            result_nodes.append(node)
    return result_nodes