from typing import Optional


def unflatten_dict(dict_: dict, separator: Optional[str] = ".") -> dict:
    """Unflattens a dictionary, reveres `flatten_dict`

    Args:
        dict_: The dictionary to unflatten
        separator: The sepearator that was used to flatten the dict

    """
    result_dict = {}
    for key, value in dict_.items():
        parts = key.split(separator)
        d = result_dict
        for part in parts[:-1]:
            if part not in d:
                d[part] = dict()
            d = d[part]
        d[parts[-1]] = value
    return result_dict