title: Check whether a node exists in networkx
body: <p>I have a graph where each node have three attributes: 'name', 'type', 'tag'.
  I want to create a function to check whether a node exists for a given attribute and value. For example: check if a node with attribute 'tag' = '1' exists. I wrote the following code:</p>
  
  <pre><code>def find_node(gr, att, val):
      nodesAt5 = filter(lambda (n, d): d[att] == val, gr.nodes(data=True))
      return nodesAt5
  </code></pre>
  
  <p>And I call the function as:</p>
  
  <pre><code>if not find_node(G, 'tag', w):
      # do something
  </code></pre>
  
  <p>It gives this error:</p>
  
  <pre><code>KeyError: 'tag'
  </code></pre>
  
  <p>Any suggestions?</p>