def METHOD_NAME(process: subprocess.Popen, f: TextIO):
    assert process.stdout, "stdout should not be None"
    for line in process.stdout:
        for out_file in [sys.stdout, f]:
            print(line.strip(), file=out_file)