pipe large amount of data to stdin while using subprocess.Popen

I'm kind of struggling to understand what is the python way of solving this simple problem. My problem is quite simple. If you use the follwing code it will hang. This is well documented in the