def allow_implicit_stop(gen_func):
@functools.wraps(gen_func)<EOL>def wrapper(*args, **kwargs):<EOL><INDENT>with warnings.catch_warnings():<EOL><INDENT>for cls in [DeprecationWarning, PendingDeprecationWarning]:<EOL><INDENT>warnings.filterwarnings(<EOL>action="<STR_LIT:ignore>",<EOL>message="<STR_LIT>",<EOL>category=cls,<EOL>)<EOL><DEDENT>try:<EOL><INDENT>for item in gen_func(*args, **kwargs):<EOL><INDENT>yield item<EOL><DEDENT><DEDENT>except RuntimeError as exc:<EOL><INDENT>if type(exc.__cause__) is StopIteration:<EOL><INDENT>return<EOL><DEDENT>raise<EOL><DEDENT><DEDENT><DEDENT>return wrapper<EOL>
Fix the backwards-incompatible PEP-0479 gotcha/bug
https://www.python.org/dev/peps/pep-0479