code: def _process_module_order(parser, module, i, result):
      
      #Some code might decide to use the fortpy module methods for general
      #development, ignore it since we know it will be present in the end.
      if module == "fortpy" or module == "fpy_auxiliary":
          return
  
      #See if the parser has alread loaded this module.
      if module not in parser.modules:
          parser.load_dependency(module, True, True, False)
  
      #It is possible that the parser couldn't find it, if so
      #we can't get a self-consistent ordering.
      if module in parser.modules:
          modneeds = parser.modules[module].needs
          for modn in modneeds:
              if modn not in result:
                  #Since this module depends on the other, insert the other
                  #above it in the list.
                  result.insert(i, modn)
              else:
                  x = result.index(modn)
                  if x > i:
                      #We need to move this module higher up in the food chain
                      #because it is needed sooner.
                      result.remove(modn)
                      result.insert(i, modn)
  
              newi = result.index(modn)
              _process_module_order(parser, modn, newi, result)
      else:
          raise ValueError("unable to find module {}.".format(module))
docs: Adds the module and its dependencies to the result list.