def back_tick(cmd, ret_err=False, as_str=True, shell=False):
 proc = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=shell)
 (out, err) = proc.communicate()
 retcode = proc.returncode
 if (retcode is None):
  proc.terminate()
  raise RuntimeError((cmd + ' process did not terminate'))
 if (retcode != 0):
  raise RuntimeError((cmd + (' process returned code %d' % retcode)))
 out = out.strip()
 if as_str:
  out = out.decode('latin-1')
 if (not ret_err):
  return out
 err = err.strip()
 if as_str:
  err = err.decode('latin-1')
 return (out, err)

def back_tick ( cmd , ret_err = False , as_str = True , shell = False ) : proc = Popen ( cmd , stdout = PIPE , stderr = PIPE , shell = shell ) ( out , err ) = proc . communicate ( ) retcode = proc . returncode if ( retcode is None ) : proc . terminate ( ) raise RuntimeError ( ( cmd + ' process did not terminate' ) ) if ( retcode != 0 ) : raise RuntimeError ( ( cmd + ( ' process returned code %d' % retcode ) ) ) out = out . strip ( ) if as_str : out = out . decode ( 'latin-1' ) if ( not ret_err ) : return out err = err . strip ( ) if as_str : err = err . decode ( 'latin-1' ) return ( out , err )
run command cmd .