This forum is full of similar questions, so here is mine:

import re 
import subprocess 
rx = re.compile("(?m)^(cpu)(.*)") 
output =["cat","/proc/cpuinfo"], stdout=subprocess.PIPE) 
lines = output.stdout.decode('utf-8') 
r = 
if r: 

I expect this snipped to find some cpu in the multi-line file, but nothing is shown.
(The actual code that fails for me looks of course different, but this is the simplest test case that fails for me, and I can not figure out why…)