Capture C-level output in context managers
This library helps to redirect sys.stdout to a stream or a file while executing some piece of code, including C code running within a Python process.
sys.stdout