def toposort_flatten(data, sort=True):
result = []<EOL>for d in toposort(data):<EOL><INDENT>result.extend((sorted if sort else list)(d))<EOL><DEDENT>return result<EOL>
Returns a single list of dependencies. For any set returned by
toposort(), those items are sorted and appended to the result (just to
make the results deterministic).