def METHOD_NAME(level):
    for item in level:
        item_id = id(item)
        if item_id not in garbage_ids:
            continue
        if item_id in visited_ids:
            continue
        if item_id in stack_ids:
            candidate = stack[stack.index(item) :]
            candidate.append(item)
            found.append(candidate)
            continue
        stack.append(item)
        stack_ids.add(item_id)
        METHOD_NAME(gc.get_referents(item))
        stack.pop()
        stack_ids.remove(item_id)
        visited_ids.add(item_id)