cproc = Popen('cat | grep line', stdin=PIPE, stdout=PIPE, stderr=PIPE,
    shell=True)
out, err = cproc.communicate('this line has the word line in it')
Python subprocess module, how do I give input to the first of series of piped commands?