human
Solve the following python programming problem given the following code:
@ classmethod 
def sort_based_on_dependency(self, classes) : 
    "sorts the given Migration classes based on their dependencies
            to other Models.

        returns a list of MigrationClasses in the order they can be migrated
        or raises suitable exceptions if this couldn't be completed
        " 
    def topological_sort(edges) : 
        '
            does a topological sort on the supplied edges http://goo.gl/lkOt1
            ' 
        G = nx.DiGraph () 
        for path in edges : 
            G.add_nodes_from (path) 
            G.add_path (path) 
return nx.topological_sort (G) 
dependency_graphs = [(mig.depends_on + [mig.model]) for mig in classes] 
    ordered_models = topological_sort (dependency_graphs) 
    ordered_migrations = [] 
    for model in ordered_models : 
        matching_mig = [cla for cla in classes if (cla.model == model)] 
        if (len (matching_mig) == 1) : 
            ordered_migrations.append (matching_mig [0]) 
else : 
            if (len (dependency_graphs) == 0) : 
                raise AttributeError (("There is no migration available for '%s'" % model)) 
else : 
                raise AttributeError (("InvalidState: '%s' has more than one migration" % model)) 
return ordered_migrations 

    
    

    Fix the buggy line: if (len (dependency_graphs) == 0) :
assistant
#Here is Python program to fix the buggy line: if (len (dependency_graphs) == 0) :
.

if (len (matching_mig) == 0) :