def sh3(cmd):
 p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True)
 (out, err) = p.communicate()
 retcode = p.returncode
 if retcode:
  raise CalledProcessError(retcode, cmd)
 else:
  return (out.rstrip(), err.rstrip())

def sh3 ( cmd ) : p = Popen ( cmd , stdout = PIPE , stderr = PIPE , shell = True ) ( out , err ) = p . communicate ( ) retcode = p . returncode if retcode : raise CalledProcessError ( retcode , cmd ) else : return ( out . rstrip ( ) , err . rstrip ( ) )
execute command in a subshell .