code: def run_cmd(cmd, return_output=False, ignore_status=False, log_output=True, **kwargs):
      
      logger.debug('command: "%s"' % ' '.join(cmd))
      process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
                                 universal_newlines=True, **kwargs)
      output = process.communicate()[0]
      if log_output:
          logger.debug(output)
  
      if process.returncode > 0:
          if ignore_status:
              if return_output:
                  return output
              else:
                  return process.returncode
          else:
              raise subprocess.CalledProcessError(cmd=cmd, returncode=process.returncode)
      if return_output:
          return output
docs: run provided command on host system using the same user as you invoked this code, raises
      subprocess.CalledProcessError if it fails
  
      :param cmd: list of str
      :param return_output: bool, return output of the command
      :param ignore_status: bool, do not fail in case nonzero return code
      :param log_output: bool, if True, log output to debug log
      :param kwargs: pass keyword arguments to subprocess.check_* functions; for more info,
              please check `help(subprocess.Popen)`
      :return: None or str