Add get_xxx_state() function to factorize duplicated code.
Miscellaneous source files for the main Python shared library