def get_interval(cursor, name):
    """Get an interval value from the system_setting table."""
    cursor.execute("""SELECT interval_value
                        FROM speedycrew.system_setting
                       WHERE name = %s""",
                   (name,))
    row = cursor.fetchone()
    if row:
        if row[0] is not None:
            return row[0]
        else:
            raise Exception("Expected system setting %s to have a non-NULL interval_value" % name)
    else:
        raise Exception("Expected there to be a system setting called %s" % name)