def sort(tuples, allitems):

    for set_ in sort_as_subsets(tuples, allitems):
        for s in set_:
            yield s
sort the given list of items by dependency.
dataset/ETHPy150Open RoseOu/flasky/venv/lib/python2.7/site-packages/sqlalchemy/util/topological.py/sort