def _SetConnection(connection):
 __InitConnection()
 _thread_local.connection_stack[(-1)] = connection

def _SetConnection ( connection ) : __InitConnection ( ) _thread_local . connection_stack [ ( - 1 ) ] = connection
sets the datastore connection local to the thread .