def safe_infer(node, context=None):
try:<EOL><INDENT>inferit = node.infer(context=context)<EOL>value = next(inferit)<EOL><DEDENT>except exceptions.InferenceError:<EOL><INDENT>return None<EOL><DEDENT>try:<EOL><INDENT>next(inferit)<EOL>return None  <EOL><DEDENT>except exceptions.InferenceError:<EOL><INDENT>return None  <EOL><DEDENT>except StopIteration:<EOL><INDENT>return value<EOL><DEDENT>
Return the inferred value for the given node.

    Return None if inference failed or if there is some ambiguity (more than
    one node has been inferred).