'Create a new event in the cleanup_event table.'

def _create_event(self, message=None):

    if (message is None):
        message = inspect.stack()[1][3]
    sql = '\n                                                INSERT    INTO    cleanup_event\n                                                                                                (create_time,    message)\n                                                                    VALUES    (NOW(),    %s)\n                                                        RETURNING    id;\n                                '
    log.debug((('SQL    is:    %s' % sql) % (("'" + message) + "'")))
    args = (message,)
    cur = self.conn.cursor()
    if self.options.dry_run:
        sql = 'SELECT    MAX(id)    FROM    cleanup_event;'
        cur.execute(sql)
        max_id = cur.fetchone()[0]
        if (max_id is None):
            sql = "INSERT    INTO    cleanup_event    (create_time,    message)    VALUES    (NOW(),    'dry_run_event')    RETURNING    id;"
            cur.execute(sql)
            max_id = cur.fetchone()[0]
            self.conn.commit()
            log.info('An    event    must    exist    for    the    subsequent    query    to    succeed,    so    a    dummy    event    has    been    created')
        else:
            log.info(('Not    executing    event    creation    (increments    sequence    even    when    rolling    back),    using    an    old    event    ID    (%i)    for    dry    run' % max_id))
        return max_id
    log.info('Executing    SQL')
    cur.execute(sql, args)
    log.info(('Database    status:    %s' % cur.statusmessage))
    return cur.fetchone()[0]
