code: def has_value(key):
      '''
      Determine whether a key exists in the grains dictionary.
  
      Given a grains dictionary that contains the following structure::
  
          {'pkg': {'apache': 'httpd'}}
  
      One would determine if the apache key in the pkg dict exists by::
  
          pkg:apache
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' grains.has_value pkg:apache
      '''
      return salt.utils.data.traverse_dict_and_list(
          __grains__,
          key,
          KeyError) is not KeyErrof has_value(key):
      '''
      Determine whether a key exists in the grains dictionary.
  
      Given a grains dictionary that contains the following structure::
  
          {'pkg': {'apache': 'httpd'}}
  
      One would determine if the apache key in the pkg dict exists by::
  
          pkg:apache
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' grains.has_value pkg:apache
      '''
      return salt.utils.data.traverse_dict_and_list(
          __grains__,
          key,
          KeyError) is not KeyError
docs: Determine whether a key exists in the grains dictionary.
  
      Given a grains dictionary that contains the following structure::
  
          {'pkg': {'apache': 'httpd'}}
  
      One would determine if the apache key in the pkg dict exists by::
  
          pkg:apache
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' grains.has_value pkg:apache