def unflatten_dict(d_flat):
    """Unflattens single-level-tuple-keyed dict into dict
    """
    result = type(d_flat)()
    for k_tuple, v in d_flat.items():
        d_curr = result
        for i, k in enumerate(k_tuple):
            if i == len(k_tuple) - 1:
                d_curr[k] = v
            elif k not in d_curr:
                d_curr[k] = type(d_flat)()
            d_curr = d_curr[k]
    return result