<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def safe_infer(node, context=None):
 """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). """

    try:
        inferit = node.infer(context=context)
        value = next(inferit)
    except exceptions.InferenceError:
        return None
    try:
        next(inferit)
        return None  # None if there is ambiguity on the inferred node
    except exceptions.InferenceError:
        return None  # there is some kind of ambiguity
    except StopIteration:
        return value