The threadinglocal module is accessible via the sqlapi.util module.
See the source for more information.