def functionalize_loops(tfssa):
    """
    Functionalize all loops in an tfssa
    """
    done = False
    while not done:
        done = True
        for f in list(tfssa.functions.keys()):
            functionalize = FunctionalizeLoops()
            ret = functionalize.functionalize_loops(tfssa, f)
            if ret:
                done = False

    Functionalize all loops in an tfssa
    
coremltools/converters/mil/frontend/tensorflow/tf_graph_pass/functionalize_loops.py