def recursive_repr(func):
repr_running = set()<EOL>@wraps(func)<EOL>def wrapper(self):<EOL><INDENT>"<STR_LIT>"<EOL>key = id(self), get_ident()<EOL>if key in repr_running:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>repr_running.add(key)<EOL>try:<EOL><INDENT>return func(self)<EOL><DEDENT>finally:<EOL><INDENT>repr_running.discard(key)<EOL><DEDENT><DEDENT>return wrapper<EOL>
Decorator to prevent infinite repr recursion.