def order_by_dependence(parameters):
    """
    Takes a list of parameters from a dynamoDB table and organize them by dependence.
    The output is a list of lists; for each sub-list there is a root parameter 
    (that do not depend on anything) and the parameters that do depend 
    """
    # Selects all table items that does not depend on others:
    roots = [leaf for leaf in parameters if 'dependence' not in leaf.keys() or leaf['dependence']==None]
    # Selects all table items that does depend on others:
    leafs = [leaf for leaf in parameters if 'dependence' in leaf.keys() and leaf['dependence']!=None]

    graphs = []
    for root in roots:
        
        # A graph starts with a root:
        graph = [root]
        branches = [root['name']]
        for leaf in leafs:
            # If a leaf depends on any parameter present in that graph, add it to that graph:
            if leaf['dependence']['name'] in branches:
                graph.append(leaf)
                branches.append(leaf['name'])
        # Put this graph (that starts with a certain root) in the list of graphs:
        graphs.append(graph)
        
    return graphs