def unflatten_dict(dic, sep="/"):
    """
    Unflattens a flattened dictionary into a nested dictionary.

    .. code-block:: python
        :caption: Example

        >>> Dict = {"/a":1, "/b/c":1, "/b/d/e":2, "/b/d/f":3}
        >>> unflatten_dict(Dict)
        {"a":1, "b":{"c":1, "d":{"e":2, "f":3}}}
    
    """
    def _insert(D, address, value):
        res = D
        parts = address.split(sep)
        parts = parts[1:] # Disregard the first as it should be empty
        for p in parts[:-1]: # Disregard the last which should contain the value finally.
            if not p in res:
                res[p] = {}
            res = res[p]
        res[parts[-1]] = value

    result = {}
    for key, value in dic.items():
        _insert(result, key, value)
    return result