python redirect stdout to another process