human
I wrote the below code

    needs_version_id = ((mapper.version_id_col is not None) and (mapper.version_id_col in mapper._cols_by_table[table]))
    def update_stmt():
        clause = sql.and_()
        for col in mapper._pks_by_table[table]:
            clause.clauses.append((col == sql.bindparam(col._label, type_=col.type)))
        if needs_version_id:
            clause.clauses.append((mapper.version_id_col == sql.bindparam(mapper.version_id_col._label, type_=mapper.version_id_col.type)))
        stmt = table.update(clause)
        return stmt
    cached_stmt = base_mapper._memo(('update', table), update_stmt)
    for ((connection, paramkeys, hasvalue, has_all_defaults, has_all_pks), records) in groupby(update, (lambda rec: (rec[4], set(rec[2]), bool(rec[5]), rec[6], rec[7]))):
        rows = 0
        records = list(records)
        statement = cached_stmt
        assert_singlerow = connection.dialect.supports_sane_rowcount
        assert_multirow = (assert_singlerow and connection.dialect.supports_sane_multi_rowcount)
        allow_multirow = (has_all_defaults and (not needs_version_id))
        if (not has_all_pks):
            statement = statement.return_defaults()
        elif (bookkeeping and (not has_all_defaults) and mapper.base_mapper.eager_defaults):
            statement = statement.return_defaults()
        elif (mapper.version_id_col is not None):
            statement = statement.return_defaults(mapper.version_id_col)
        if hasvalue:
            for (state, state_dict, params, mapper, connection, value_params, has_all_defaults, has_all_pks) in records:
                c = connection.execute(statement.values(value_params), params)
                if bookkeeping:
                    _postfetch(mapper, uowtransaction, table, state, state_dict, c, c.context.compiled_parameters[0], value_params)
                rows += c.rowcount
                check_rowcount = True
        elif (not allow_multirow):
            check_rowcount = assert_singlerow
            for (state, state_dict, params, mapper, connection,...

What's a good function header?

Here's a good function header?
assistant
#Here's a good function header.

def _emit_update_statements(base_mapper, uowtransaction, cached_connections, mapper, table, update, bookkeeping=True):