This is a sample python extension written in C. This is the result of two tutorials for python 2.7:
Simply run python setup.py build and python setup.py install. This will expose the spam module. From there use spam.system() to execute shell commands. E.x spam.system("ls -l").