def check_necessary_conf_property(conf, name, expected_type=None):
    """
    Check that property is set or set its value with a provided value.

    :param conf: Dictionary.
    :param name: Configuration property string.
    :param expected_type: Check that given value has an expected type.
    :return: True
    """
    if name not in conf:
        raise KeyError("Expect configuration property {!r} to be set properly".format(name))
    elif name in conf and expected_type and not isinstance(conf[name], expected_type):
        raise TypeError("Expect configuration property {!r} to be set with a {!r} value but it has type {!r}".
                        format(name, str(expected_type), str(type(conf[name]))))
    return True