def to_dict(key, value):
    """
    Creates a dict from a dot-separated path-style key and a value.

    Examples:
    "foo", "bar" => "baz"
    "foo.bar", "baz" => {"foo"{"bar":"baz}}
    """
    key_parts = key.split('.')
    result = {}
    current = result
    for key_part in key_parts[:-1]:
        current = current.setdefault(key_part, {})
    current[key_parts[-1]] = value
    return result
