code: def check_output(cmd):
      
      popen = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
      out = popen.communicate()[0].strip()
      if not isinstance(out, str):
          out = out.decode(sys.stdout.encoding)
      return out
docs: Version of check_output which does not throw error