docs: def _find_advisory_targets(name=None,
                             advisory_ids=None,
                             **kwargs):
      '''
      Inspect the arguments to pkg.patch_installed and discover what advisory
      patches need to be installed. Return a dict of advisory patches to install.
      '''
      cur_patches = __salt__['pkg.list_installed_patches'](**kwargs)
      if advisory_ids:
          to_download = advisory_ids
      else:
          to_download = [name]
          if cur_patches.get(name, {}):
              # Advisory patch already installed, no need to install it again
              return {'name': name,
                      'changes': {},
                      'result': True,
                      'comment': 'Advisory patch {0} is already '
                                 'installed'.format(name)}
  
      # Find out which advisory patches will be targeted in the call to pkg.install
      targets = []
      for patch_name in to_download:
          cver = cur_patches.get(patch_name, {})
          # Advisory patch not yet installed, so add to targets
          if not cver:
              targets.append(patch_name)
              continue
  
      if not targets:
          # All specified packages are already downloaded
          msg = ('All specified advisory patches are already installed')
          return {'name': name,
                  'changes': {},
                  'result': True,
                  'comment': msg}
  
      return targets