<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def transactional(wrapped):
 """ A decorator to denote that the content of the decorated function or method is to be ran in a transaction. The following code is equivalent to the example for :py:func:`dbkit.transaction`:: import sqlite3 import sys from dbkit import connect, transactional, query_value, execute with connect(sqlite3, '/path/to/my.db') as ctx: try: change_ownership(page_id, new_owner_id) catch ctx.IntegrityError: print >> sys.stderr, "Naughty!" @transactional def change_ownership(page_id, new_owner_id):
 old_owner_id = query_value( "SELECT owner_id FROM pages WHERE page_id = ?", (page_id,)) execute( "UPDATE users SET owned = owned - 1 WHERE id = ?", (old_owner_id,)) execute( "UPDATE users SET owned = owned + 1 WHERE id = ?", (new_owner_id,)) execute( "UPDATE pages SET owner_id = ? WHERE page_id = ?", (new_owner_id, page_id)) """

    # pylint: disable-msg=C0111
    def wrapper(*args, **kwargs):
        with Context.current().transaction():
            return wrapped(*args, **kwargs)
    return functools.update_wrapper(wrapper, wrapped)