def traverse_frozen_data(data_structure):
    """Yields the leaves of the frozen data-structure pre-order.

    It will produce the same order as one would write the data-structure."""
    parent_stack = [data_structure]
    while parent_stack:
        node = parent_stack.pop(0)
        # We don't iterate strings
        tlen = -1
        if not isinstance(node, _string_types):
            # If item has a length we freeze it
            try:
                tlen = len(node)
            except:
                pass
        if tlen == -1:
            yield node
        else:
            parent_stack = list(node) + parent_stack
Yields the leaves of the frozen data-structure pre-order.

    It will produce the same order as one would write the data-structure.