I'm trying to build a python app to quickly generate color side-by-side diffs in python. My problem is that I can generate side-by-side from the linux CLI, but diffs fail under python no matter what command-mangling I've tried (see attempts below).
This is correct behavior if I run the diffs from linux CLI (under wsltty).  Note that I get the same output from PuTTY:

This is the typical unwanted behavior when I run the diffs from a python script...

QUESTIONS:
- Why are the python attempts below failing to generate side-by-side diffs?
 - What can I do (under python) to render output as I can from the CLI (screenshot above)?
 
The following python script contains the attempts I've tried to make python-rendered side-by-side diffs work... in short, I've tried a number of attempts with Popen(), as well as subprocess.run() and os.system()...
# filename: test_ydiff.py
from subprocess import run, Popen, PIPE
import shlex, os, pydoc
TEST_01 = True
TEST_02 = True
TEST_03 = True
if TEST_01:
    cmd_01_input   = "diff -u f_01.txt f_02.txt"
    cmd_01_output  = "ydiff -s"
    proc_01_input  = Popen(shlex.split(cmd_01_input),
                                    stdout=PIPE)
    proc_01_output = Popen(shlex.split(cmd_01_output),
        stdin=proc_01_input.stdout, stdout=PIPE)
    stdout_str, stdin_str = proc_01_output.communicate()
    print(stdout_str.decode('utf-8'))
if TEST_02:
    cmd_02_shell    = "diff -u f_01.txt f_02.txt | ydiff -s"
    proc_02_shell   = Popen(cmd_02_shell, shell=True, stdout=PIPE)
    stdout_str, stdin_str = proc_02_shell.communicate()
    print(stdout_str.decode('utf-8'))
if TEST_03:
    run("/usr/bin/diff -u ./f_01.txt ./f_02.txt|/home/mpennington/venv/py37_u18/bin/ydiff -s")
First text file to be diffed:
# filename: f_01.txt
!
interface Ethernet0/0
 ip address 10.0.0.1 255.255.255.0
 no ip proxy-arp
 no ip unreachables
 ip access-group FILTER_in in
!
Second text file to be diffed:
# filename: f_02.txt
!
interface Ethernet0/0
 ip address 10.0.0.1 255.255.255.0
 ip proxy-arp
 no ip unreachables
!
I'm running Python 3.7.6 under Ubuntu 18... I've got ydiff==1.1 (github: ydiff)