code: def sort_dependencies(self, image, dependencies=None):
          
          if dependencies is None:
              dependencies = OrderedDict()  # using this as an ordered set - not storing any values
  
          if image in dependencies:
              return
  
          requires = self.ymldefs[image].get('requires', [])
  
          for dep in requires:
              self.sort_dependencies(dep, dependencies)
  
          dependencies[image] = None
          return dependencies.keys()
docs: 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