def _set_autocommit(connection):
 if hasattr(connection.connection, 'autocommit'):
  connection.connection.autocommit(True)
 elif hasattr(connection.connection, 'set_isolation_level'):
  connection.connection.set_isolation_level(0)

def _set_autocommit ( connection ) : if hasattr ( connection . connection , 'autocommit' ) : connection . connection . autocommit ( True ) elif hasattr ( connection . connection , 'set_isolation_level' ) : connection . connection . set_isolation_level ( 0 )
make sure a connection is in autocommit mode .