<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def db_exec_with_cursor(self, cursor, sql: str, *args) -> int: """Executes SQL on a supplied cursor, with "?" placeholders, substituting in the arguments. Returns number of rows affected."""

        sql = self.localize_sql(sql)
        try:
            debug_sql(sql, args)
            cursor.execute(sql, args)
            return cursor.rowcount
        except:  # nopep8
            log.exception("db_exec_with_cursor: SQL was: " + sql)
            raise