def with_db_cursor(func):
@functools.wraps(func)<EOL>def wrapped(*args, **kwargs):<EOL><INDENT>if '<STR_LIT>' in kwargs or func.__code__.co_argcount == len(args):<EOL><INDENT>return func(*args, **kwargs)<EOL><DEDENT>with db_connect() as db_connection:<EOL><INDENT>with db_connection.cursor() as cursor:<EOL><INDENT>kwargs['<STR_LIT>'] = cursor<EOL>return func(*args, **kwargs)<EOL><DEDENT><DEDENT><DEDENT>return wrapped<EOL>
Decorator that supplies a cursor to the function.
    This passes in a psycopg2 Cursor as the argument 'cursor'.
    It also accepts a cursor if one is given.