def get_or_die(conf, name, expected_type=None):
    """
    Return configuration property value and expect it to be set.

    :param conf: Dictionary.
    :param name: Configuration property string.
    :param expected_type: Type object.
    :return: Configuration property value.
    """
    if name not in conf or (expected_type and not isinstance(conf.get(name), expected_type)):
        raise KeyError("EMG requires configuration property {!r} to be set as {!r}".
                       format(name, type(expected_type).__name__))
    return conf[name]