def set_var(name, value, context):
    """ Set a viarble in a dict context

    Parameters
    ----------
    name : str or list(str)
        variable name or path as list
    value : object
        anything to set
    context : dict
        variable dict
    """
    if not isinstance(name, (list, tuple)):
        name = name,
    current_context = context
    for i_name, current_name in enumerate(name):
        if i_name == len(name) - 1:
            current_context[current_name] = value
        elif current_name in current_context:
            current_context = current_context[current_name]
        else:
            new_level = {}
            current_context[current_name] = new_level
            current_context = new_level
