def unflatten(d):
    """
    This unflattens a flattened dictionary.

    Args:
        d (dict|list): The object to flatten.

    Returns:
        items (dict): The unflattened object.
    """
    items = {}
    for k, v in d.items():
        keys = k.split('.')
        sub_items = items
        for ki in keys[:-1]:
            try:
                sub_items = sub_items[ki]
            except KeyError:
                sub_items[ki] = {}
                sub_items = sub_items[ki]
        sub_items[keys[-1]] = v
    return items