def path_wrapper(func):
@functools.wraps(func)<EOL>def wrapped(node, context=None, _func=func, **kwargs):<EOL><INDENT>"""<STR_LIT>"""<EOL>if context is None:<EOL><INDENT>context = contextmod.InferenceContext()<EOL><DEDENT>if context.push(node):<EOL><INDENT>return None<EOL><DEDENT>yielded = set()<EOL>generator = _func(node, context, **kwargs)<EOL>try:<EOL><INDENT>while True:<EOL><INDENT>res = next(generator)<EOL>if res.__class__.__name__ == "<STR_LIT>":<EOL><INDENT>ares = res._proxied<EOL><DEDENT>else:<EOL><INDENT>ares = res<EOL><DEDENT>if ares not in yielded:<EOL><INDENT>yield res<EOL>yielded.add(ares)<EOL><DEDENT><DEDENT><DEDENT>except StopIteration as error:<EOL><INDENT>if error.args:<EOL><INDENT>return error.args[<NUM_LIT:0>]<EOL><DEDENT>return None<EOL><DEDENT><DEDENT>return wrapped<EOL>
return the given infer function wrapped to handle the path

    Used to stop inference if the node has already been looked
    at for a given `InferenceContext` to prevent infinite recursion