def cascade_iterator(self, type_, state, halt_on=None):
        visited_states = set()
        prp, mpp = object(), object()

        visitables = deque([(deque(self._props.values()), prp,
                             state, state.dict)])

        while visitables:
            iterator, item_type, parent_state, parent_dict = visitables[-1]
            if not iterator:
                visitables.pop()
                continue

            if item_type is prp:
                prop = iterator.popleft()
                if type_ not in prop.cascade:
                    continue
                queue = deque(prop.cascade_iterator(
                    type_, parent_state, parent_dict,
                    visited_states, halt_on))
                if queue:
                    visitables.append((queue, mpp, None, None))
            elif item_type is mpp:
                instance, instance_mapper, corresponding_state, \
                    corresponding_dict = iterator.popleft()
                yield instance, instance_mapper, \
                    corresponding_state, corresponding_dict
                visitables.append((deque(instance_mapper._props.values()),
                                   prp, corresponding_state,
                                   corresponding_dict))
Main function.
dataset/ETHPy150Open goFrendiAsgard/kokoropy/kokoropy/packages/sqlalchemy/orm/mapper.py/Mapper.cascade_iterator--crossover with--dataset/ETHPy150Open tpircher/pycrc/pycrc.py/main