code used to implement a c++ singleton into python