[Python] Easy to read 1 pass iterative, while loop + stack + 3 if statements
O(n) time and space complexity\n \n\n    def flatten(self, head: \'Node\') -> \'Node\':\n        if head:\n            n_stack = []        \n            curr_no
O(n) time and space complexity\n \n```\n    def flatten(self, head: \'Node\') -> \'Node\':\n        if head:\n            n_stack = []        \n            curr_node = head\n            while curr_node:\n                if curr_node.next:\t\t\t\t\t\t# Push the "next" (if there\'s a "next") first.\n                    n_stack.append(curr_node.next)\n                if curr_node.child:\t\t\t\t\t\t# Then push the "child" (if there\'s a child), \n                    n_stack.append(curr_node.child)\t\t# so that the "stack" would pop the immediate "child" \n                    curr_node.child = None \t\t\t\t# before any previous encountered "next".\n                if n_stack:\t\t\t\t\t\t\t\t# It will "recurse" down and bubble back up eventually.\n                    next_node = n_stack.pop()\t\t\t# Unless it has traversed through all the nodes,\n                    curr_node.next = next_node          # there\'s always some node left in the stack to pop.     \n                    next_node.prev = curr_node \t\t\t# Simply link up with whatever comes from the stack.\n                curr_node = curr_node.next \t\t\t\t# To the next node, or None if there\'s no more\n        return head\n```
['Iterator', 'Python']