Check if a node exists using Python
You can use the bpy_prop_collection.get method which acts like pythons dict.get.

import bpy

mat = bpy.data.materials["MyMaterial"]
if mat.use_nodes:
    ntree = mat.node_tree
    node = ntree.nodes.get("Diffuse BSDF", None)
    if node is not None:
        print("We Found:", node)


This is similar to using:

node = ntree.nodes["Diffuse BSDF"]


However if the node isn't found you'll get an exception.