def sort_dependencies(self, image, dependencies=None):
if dependencies is None:<EOL><INDENT>dependencies = OrderedDict()  <EOL><DEDENT>if image in dependencies:<EOL><INDENT>return<EOL><DEDENT>requires = self.ymldefs[image].get('<STR_LIT>', [])<EOL>for dep in requires:<EOL><INDENT>self.sort_dependencies(dep, dependencies)<EOL><DEDENT>dependencies[image] = None<EOL>return dependencies.keys()<EOL>
Topologically sort the docker commands by their requirements

Note:
    Circular "requires" dependencies are assumed to have already been checked in
    get_external_base_image, they are not checked here

Args:
   image (str): process this docker image's dependencies
   dependencies (OrderedDict): running cache of sorted dependencies (ordered dict)

Returns:
    List[str]: list of dependencies a topologically-sorted build order