def getstatusoutput(cmd):
 import os
 pipe = os.popen((('{ ' + cmd) + '; } 2>&1'), 'r')
 text = pipe.read()
 sts = pipe.close()
 if (sts is None):
  sts = 0
 if (text[(-1):] == '\n'):
  text = text[:(-1)]
 return (sts, text)

def getstatusoutput ( cmd ) : import os pipe = os . popen ( ( ( '{ ' + cmd ) + '; } 2>&1' ) , 'r' ) text = pipe . read ( ) sts = pipe . close ( ) if ( sts is None ) : sts = 0 if ( text [ ( - 1 ) : ] == '\n' ) : text = text [ : ( - 1 ) ] return ( sts , text )
return of executing cmd in a shell .