code: def _check_sane_and_get_gpg_version(self):
          
          proc = self._open_subprocess(["--list-config", "--with-colons"])
          result = self._result_map['list'](self)
          self._read_data(proc.stdout, result)
          if proc.returncode:
              raise RuntimeError("Error invoking gpg: %s" % result.data)
          else:
              try:
                  proc.terminate()
              except OSError:
                  log.error(("Could neither invoke nor terminate a gpg process... "
                             "Are you sure you specified the corrent (and full) "
                             "path to the gpg binary?"))
  
          version_line = result.data.partition(b':version:')[2].decode()
          if not version_line:
              raise RuntimeError("Got invalid version line from gpg: %s\n" % result.data)
          self.binary_version = version_line.split('\n')[0]
          if not _VERSION_RE.match(self.binary_version):
              raise RuntimeError("Got invalid version line from gpg: %s\n" % self.binary_version)
          log.debug("Using GnuPG version %s" % self.binary_version)
docs: Check that everything runs alright, and grab the gpg binary's
          version number while we're at it, storing it as :data:`binary_version`.
  
          :raises RuntimeError: if we cannot invoke the gpg binary.