def bayesdb_get_population(bdb, name):
    """Return the id of the population named `name` in `bdb`.

    The id is persistent across savepoints: ids are 64-bit integers
    that increase monotonically and are never reused.

    `bdb` must have a population named `name`.  If you're not sure,
    call :func:`bayesdb_has_population` first.
    """
    sql = 'SELECT id FROM bayesdb_population WHERE name = ?'
    cursor = bdb.sql_execute(sql, (name,))
    try:
        row = cursor.next()
    except StopIteration:
        raise ValueError('No such population: %r' % (repr(name),))
    else:
        assert isinstance(row[0], int)
        return row[0]