def set_nested(dictionary, keys, value):
    """Use period-separated keys to set nested dictionary value."""
    d = dictionary
    keys = keys.split('.')
    nodes, leaf = keys[:-1], keys[-1]
    for node in nodes:
        if node not in d:
            d[node] = {}
        d = d[node]
    d[leaf] = value
