docs: def version(*names, **kwargs):
      '''
      Common interface for obtaining the version of installed packages.
      Accepts full or partial FMRI. If called using pkg_resource, full FMRI is required.
      Partial FMRI is returned if the package is not installed.
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' pkg.version vim
          salt '*' pkg.version foo bar baz
          salt '*' pkg_resource.version pkg://solaris/entire
  
      '''
      if not names:
          return ''
  
      cmd = ['/bin/pkg', 'list', '-Hv']
      cmd.extend(names)
      lines = __salt__['cmd.run_stdout'](cmd, ignore_retcode=True).splitlines()
      ret = {}
      for line in lines:
          ret[_ips_get_pkgname(line)] = _ips_get_pkgversion(line)
  
      # Append package names which are not installed/found
      unmatched = list([name for name in names if not reduce(lambda x, y: x or name in y, ret, False)])  # pylint: disable=W0640
      ret.update(zip(unmatched, itertools.cycle(('',))))
  
      # Return a string if only one package name passed
      if len(names) == 1:
          try:
              return next(six.itervalues(ret))
          except StopIteration:
              return ''
  
      return ret