subprocess.Popen(command.decode(), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) code example
Example: python format subprocess output
import subprocess
output = subprocess.check_output("cat /etc/os-release", shell=True)
output = output.decode("utf-8")
print("Version info: ",output)