Compute strongly connected components
        Based on Kosaraju algo
        Implem follows wikipedia algo: https://en.wikipedia.org/wiki/Kosaraju%27s_algorithm#The_algorithm
    Args:
        function (core.declarations.function.Function)
    Returns:
        list(list(nodes))

def compute_strongly_connected_components(function):
    """
        Compute strongly connected components
        Based on Kosaraju algo
        Implem follows wikipedia algo: https://en.wikipedia.org/wiki/Kosaraju%27s_algorithm#The_algorithm
    Args:
        function (core.declarations.function.Function)
    Returns:
        list(list(nodes))
    """
    visited = {n:False for n in function.nodes}
    assigned = {n:False for n in function.nodes}
    components = []
    l = []

    def visit(node):
        if not visited[node]:
            visited[node] = True
            for son in node.sons:
                visit(son)
            l.append(node)

    for n in function.nodes:
        visit(n)

    def assign(node, root):
        if not assigned[node]:
            assigned[node] = True
            root.append(node)
            for father in node.fathers:
                assign(father, root)

    for n in l:
        component = []
        assign(n, component)
        if component:
            components.append(component)

    return components