def get_dict_to_update(var, val):
    """
    The function creates a dictionary with Variable and value.
    If Variable has "." separated keys then the value is updated at
    appropriate level of the nested dictionary.
    :param var: Dictionary Key or Key separated with "." for nested dict keys.
    :param val: Value for the Key.

    :return: Dictionary
    """
    dic = {}
    if '.' in var:
        [key, value] = var.split('.', 1)
        dic[key] = get_dict_to_update(value, val)
    else:
        dic[var] = val
    return dic