code: def run_cmd(cmd, out=os.path.devnull, err=os.path.devnull):
      
  
      logger.debug(' '.join(cmd))
      with open(out, 'w') as hout:
          proc = subprocess.Popen(cmd, stdout=hout, stderr=subprocess.PIPE)
          err_msg = proc.communicate()[1].decode()
      with open(err, 'w') as herr:
          herr.write(str(err_msg))
      msg = '({}) {}'.format(' '.join(cmd), err_msg)
      if proc.returncode != 0:
          logger.error(msg)
          raise RuntimeError(msg)
docs: Runs an external command
  
      :param list cmd: Command to run.
      :param str out: Output file
      :param str err: Error file
      :raises: RuntimeError