The stub_template class is accessible via the testtools.stubs module.
See the source for more information.