def CheckConfigurationItem(self, dictionary, item, typ=None):
    """Checks for the presence of an item in a dictionary.

    Args:
      dictionary: Configuration part that should be checked.
      item: Name of the key to check as string.
      typ: Type of the value to check. Default is to not check the type.

    Raises:
      DefinateConfigError: The configuration is not sane.
    """
    if not dictionary or item not in dictionary:
      raise DefinateConfigError('"%s" is not defined in config: %s'
                                % (item, dictionary))
    if typ and type(dictionary[item]) is not typ:
      raise DefinateConfigError('Type of "%s" is %s, expected %s.' %
                                (item, str(type(dictionary[item])), str(typ)))
dataset/ETHPy150Open google/capirca/definate/yaml_validator.py/YamlValidator.CheckConfigurationItem/original