code: def _version_from_tool(self, executable, arg='--version', use_stderr=False, ignore_stderr=False):
          
          try:
              process = subprocess.Popen([executable, arg],
                                         stdout=subprocess.PIPE, stderr=subprocess.PIPE)
              (stdout, stderr) = process.communicate()
          except OSError as e:
              logging.warning('Cannot run {0} to determine version: {1}'.
                              format(executable, e.strerror))
              return ''
          if stderr and not use_stderr and not ignore_stderr:
              logging.warning('Cannot determine {0} version, error output: {1}'.
                              format(executable, util.decode_to_string(stderr)))
              return ''
          if process.returncode:
              logging.warning('Cannot determine {0} version, exit code {1}'.
                              format(executable, process.returncode))
              return ''
          return util.decode_to_string(stderr if use_stderr else stdout).strip()
docs: Get version of a tool by executing it with argument "--version"
          and returning stdout.
          @param executable: the path to the executable of the tool (typically the result of executable())
          @param arg: an argument to pass to the tool to let it print its version
          @param use_stderr: True if the tool prints version on stderr, False for stdout
          @return a (possibly empty) string of output of the tool