So the function i wrote will do just that. See here...
[{"id":"96eaea5a.44b318","type":"inject","z":"db525c47.ab486","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":860,"y":120,"wires":[["53cf112.94802f"]]},{"id":"53cf112.94802f","type":"function","z":"db525c47.ab486","name":"fake serial buffer SOH P0 STX","func":"msg.payload = Buffer.from([0x1, 0x50, 0x30, 0x2, 109,111,114,101,32,100,97,116,97,32,104,101,114,101, 0x3])\nreturn msg;","outputs":1,"noerr":0,"x":1070,"y":120,"wires":[["c83b3cbd.0f4fe"]]},{"id":"c83b3cbd.0f4fe","type":"function","z":"db525c47.ab486","name":"Is P0?","func":"if(Buffer.isBuffer(msg.payload) && msg.payload.length >= 4) {\n if(msg.payload[0] != 0x1) return null;\n if(msg.payload[1] != 0x50) return null;\n if(msg.payload[2] != 0x30) return null;\n if(msg.payload[3] != 0x2) return null;\n}\nreturn msg;\n","outputs":1,"noerr":0,"x":1290,"y":160,"wires":[["53a1d8b.acea928"]]},{"id":"53a1d8b.acea928","type":"debug","z":"db525c47.ab486","name":"So, this message IS SOH P0 STX - lets do something with it","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1100,"y":220,"wires":[]},{"id":"2d5250b0.9339b","type":"inject","z":"db525c47.ab486","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":860,"y":160,"wires":[["69dcb19e.b24af"]]},{"id":"69dcb19e.b24af","type":"function","z":"db525c47.ab486","name":"fake serial buffer SOH P7 STX","func":"msg.payload = Buffer.from([0x1, 0x50, 0x37, 0x2, 109,111,114,101,32,100,97,116,97,32,104,101,114,101, 0x3])\nreturn msg;","outputs":1,"noerr":0,"x":1070,"y":160,"wires":[["c83b3cbd.0f4fe"]]}]
So do you mind me asking why you want to pass the data to python? Perhaps you can avoid the overhead of shelling python processes & do it all in node-red?