human
Complete this python program:
def _emit_delete_statements(base_mapper, uowtransaction, cached_connections, mapper, table, delete):
assistant
#Here is the Python program you requested.

    """Emit DELETE statements corresponding to value lists collected
    by _collect_delete_commands().
    """
    need_version_id = ((mapper.version_id_col is not None) and (mapper.version_id_col in mapper._cols_by_table[table]))
    def delete_stmt():
        clause = sql.and_()
        for col in mapper._pks_by_table[table]:
            clause.clauses.append((col == sql.bindparam(col.key, type_=col.type)))
        if need_version_id:
            clause.clauses.append((mapper.version_id_col == sql.bindparam(mapper.version_id_col.key, type_=mapper.version_id_col.type)))
        return table.delete(clause)
    statement = base_mapper._memo(('delete', table), delete_stmt)
    for (connection, recs) in groupby(delete, (lambda rec: rec[1])):
        del_objects = [params for (params, connection) in recs]
        connection = cached_connections[connection]
        expected = len(del_objects)
        rows_matched = (-1)
        only_warn = False
        if connection.dialect.supports_sane_multi_rowcount:
            c = connection.execute(statement, del_objects)
            if (not need_version_id):
                only_warn = True
            rows_matched = c.rowcount
        elif need_version_id:
            if connection.dialect.supports_sane_rowcount:
                rows_matched = 0
                for params in del_objects:
                    c = connection.execute(statement, params)
                    rows_matched += c.rowcount
            else:
                util.warn(('Dialect    %s    does    not    support    deleted    rowcount    -    versioning    cannot    be    verified.' % connection.dialect.dialect_description), stacklevel=12)
                connection.execute(statement, del_objects)
        else:
            connection.execute(statement, del_objects)
        if (base_mapper.confirm_deleted_rows and (rows_matched > (-1)) and (expected != rows_matched)):
            if only_warn:
                util.warn(("DELETE    statement    on    table    '%s'    expected    to    delete    %d    row(s);    %d    were    matched.        Please    set    confirm_deleted_rows=False    within    the    mapper   ...