def _is_key(config_item, parent):
  """Returns true if the item is a key, false if it's a directory.

  Args:
    config_item: A single item from the YAML config, as a Python dict.
    parent: DConf path to the item's parent directory.

  Raises:
    ValueError: The item is neither or both.
  """
  if 'dir' in config_item and 'key' in config_item:
    raise ValueError(
        'Item in {!r} has both \'dir\' and \'key\' attrs.'.format(parent))
  elif 'dir' not in config_item and 'key' not in config_item:
    raise ValueError(
        'Item in {!r} has neither a \'dir\' nor a \'key\' attr.'.format(parent))
  return 'key' in config_item