code: def call_cmd(cmdlist, stdin=None):
      
      termenc = urwid.util.detected_encoding
      if isinstance(stdin, str):
          stdin = stdin.encode(termenc)
      try:
  
          logging.debug("Calling %s" % cmdlist)
          proc = subprocess.Popen(
              cmdlist,
              stdout=subprocess.PIPE,
              stderr=subprocess.PIPE,
              stdin=subprocess.PIPE if stdin is not None else None)
      except OSError as e:
          out = b''
          err = e.strerror
          ret = e.errno
      else:
          out, err = proc.communicate(stdin)
          ret = proc.returncode
  
      out = string_decode(out, termenc)
      err = string_decode(err, termenc)
      return out, err, ret
docs: get a shell commands output, error message and return value and immediately
      return.
  
      .. warning::
  
          This returns with the first screen content for interactive commands.
  
      :param cmdlist: shellcommand to call, already splitted into a list accepted
                      by :meth:`subprocess.Popen`
      :type cmdlist: list of str
      :param stdin: string to pipe to the process
      :type stdin: str, bytes, or None
      :return: triple of stdout, stderr, return value of the shell command
      :rtype: str, str, int