def deflatten(structure_pattern,data_stream):
    """
    The deflatten function takes a structure pattern flat and a data stream (list of values), and produces a nested data structure according to those inputs.
    This is the inverse function of flatten()
    >>> deflatten('..[.[..[.]].]...',[1, 'abc', 0, 1, 1, 5, 'def', 9, 10, 11])
    [1, 'abc', [0, [1, 1, [5]], 'def'], 9, 10, 11]
    """
    data_structure = []
    stack = [data_structure]
    pos = 0
    for token in structure_pattern:
        if token == '[':
            new_sublist = []
            stack[-1].append(new_sublist)
            stack.append(new_sublist)
        elif token == ']':
            stack.pop(-1)
        elif token == '.':
            stack[-1].append(data_stream[pos])
            pos += 1
    return data_structure