Basically you can just `from sh import [command]` and then have an installed binary command available as function
from sh import ifconfig
print(ifconfig("eth0"))https://pypi.org/project/pypyp/
It takes cares of the input and output boilerplate so you can focus on the actual code that you wanted python for.
> seq 1 5 | pyp 'sum(map(int, lines))'
> ls | pyp 'Path(x).suffix'
[1] https://github.com/jean-philippe-martin/pawk