def transaction(func):
@wraps(func)<EOL>def wrapper(cls, *args, **kwargs):<EOL><INDENT>with (yield from cls.get_cursor(_CursorType.NAMEDTUPLE)) as c:<EOL><INDENT>try:<EOL><INDENT>yield from c.execute('<STR_LIT>')<EOL>result = (yield from func(cls, c, *args, **kwargs))<EOL><DEDENT>except Exception:<EOL><INDENT>yield from c.execute('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>yield from c.execute('<STR_LIT>')<EOL>return result<EOL><DEDENT><DEDENT><DEDENT>return wrapper<EOL>
Provides a transacted cursor which will run in autocommit=false mode

For any exception the transaction will be rolled back.
Requires that the function being decorated is an instance of a class or object
that yields a cursor from a get_cursor(cursor_type=CursorType.NAMEDTUPLE) coroutine or provides such an object
as the first argument in its signature

Yields:
    A client-side transacted named cursor