Source code refactoring. Extracted common functionality in cpp_helpers.c...

...c and python/python_generator.cc
Revert this change.