def dependency_sorted(containers):
if not isinstance(containers, collections.Mapping):<EOL><INDENT>containers = dict((c.name, c) for c in containers)<EOL><DEDENT>container_links = dict((name, set(c.links.keys()))<EOL>for name, c in containers.items())<EOL>sorted_names = _resolve(container_links)<EOL>return [containers[name] for name in sorted_names]<EOL>
Sort a dictionary or list of containers into dependency order

    Returns a sequence