def setprofile(func):
 global _profile_hook
 _profile_hook = func

def setprofile ( func ) : global _profile_hook _profile_hook = func
set a profile function for all threads started from the threading module .