def popen_wrapper(args, os_err_exc_type=CommandError):
 try:
  p = Popen(args, shell=False, stdout=PIPE, stderr=PIPE, close_fds=(os.name != 'nt'), universal_newlines=True)
 except OSError as e:
  six.reraise(os_err_exc_type, os_err_exc_type(('Error executing %s: %s' % (args[0], e.strerror))), sys.exc_info()[2])
 (output, errors) = p.communicate()
 return (output, force_text(errors, DEFAULT_LOCALE_ENCODING, strings_only=True), p.returncode)

def popen_wrapper ( args , os_err_exc_type = CommandError ) : try : p = Popen ( args , shell = False , stdout = PIPE , stderr = PIPE , close_fds = ( os . name != 'nt' ) , universal_newlines = True ) except OSError as e : six . reraise ( os_err_exc_type , os_err_exc_type ( ( 'Error executing %s: %s' % ( args [ 0 ] , e . strerror ) ) ) , sys . exc_info ( ) [ 2 ] ) ( output , errors ) = p . communicate ( ) return ( output , force_text ( errors , DEFAULT_LOCALE_ENCODING , strings_only = True ) , p . returncode )
friendly wrapper around popen .