docs: def present(name, profile="splunk", **kwargs):
      '''
      Ensure a search is present
  
      .. code-block:: yaml
  
          API Error Search:
            splunk_search.present:
              search: index=main sourcetype=blah
              template: alert_5min
  
      The following parameters are required:
  
      name
          This is the name of the search in splunk
      '''
      ret = {
          'name': name,
          'changes': {},
          'result': None,
          'comment': ''
      }
  
      target = __salt__['splunk_search.get'](name, profile=profile)
      if target:
          if __opts__['test']:
              ret['comment'] = "Would update {0}".format(name)
              return ret
          # found a search... updating
          result = __salt__['splunk_search.update'](
              name, profile=profile, **kwargs
          )
          if not result:
              # no update
              ret['result'] = True
              ret['comment'] = "No changes"
          else:
              (newvalues, diffs) = result
              old_content = dict(target.content)
              old_changes = {}
              for x in newvalues:
                  old_changes[x] = old_content.get(x, None)
              ret['result'] = True
              ret['changes']['diff'] = diffs
              ret['changes']['old'] = old_changes
              ret['changes']['new'] = newvalues
      else:
          if __opts__['test']:
              ret['comment'] = "Would create {0}".format(name)
              return ret
          # creating a new search
          result = __salt__['splunk_search.create'](
              name, profile=profile, **kwargs
          )
          if result:
              ret['result'] = True
              ret['changes']['old'] = False
              ret['changes']['new'] = kwargs
          else:
              ret['result'] = False
              ret['comment'] = 'Failed to create {0}'.format(name)
      return ret