def leave_transaction_management():
 thread_ident = thread.get_ident()
 if (state.has_key(thread_ident) and state[thread_ident]):
  del state[thread_ident][(-1)]
 else:
  raise TransactionManagementError("This code isn't under transaction management")
 if dirty.get(thread_ident, False):
  rollback()
  raise TransactionManagementError('Transaction managed block ended with pending COMMIT/ROLLBACK')
 dirty[thread_ident] = False

def leave_transaction_management ( ) : thread_ident = thread . get_ident ( ) if ( state . has_key ( thread_ident ) and state [ thread_ident ] ) : del state [ thread_ident ] [ ( - 1 ) ] else : raise TransactionManagementError ( "This code isn't under transaction management" ) if dirty . get ( thread_ident , False ) : rollback ( ) raise TransactionManagementError ( 'Transaction managed block ended with pending COMMIT/ROLLBACK' ) dirty [ thread_ident ] = False
leaves transaction management for a running thread .