Python obtiene salida de comando a variable

import subprocess as sp
output = sp.getoutput('whoami --version')
print (output)
Breakable Baboon