code: def sort_utility_codes(utilcodes):
      ranks = {}
  
      def get_rank(utilcode):
          if utilcode not in ranks:
              ranks[
                  utilcode
              ] = 0  # prevent infinite recursion on circular dependencies
              original_order = len(ranks)
              ranks[utilcode] = (
                  1
                  + min(
                      [get_rank(dep) for dep in utilcode.requires or ()]
                      or [-1]
                  )
                  + original_order * 1e-8
              )
          return ranks[utilcode]
  
      for utilcode in utilcodes:
          get_rank(utilcode)
      return [
          utilcode
          for utilcode, _ in sorted(ranks.items(), key=lambda kv: kv[1])
      ]
  
imports: from __future__ import absolute_import
  import itertools
  from time import time
  from .None import Errors
  from .None import DebugFlags
  from .None import Options
  from .Errors import CompileError, InternalError, AbortError
  from .None import Naming
label_desc: Use image node_id 8 for calling a global function with example usage: sort_utility_codes(utilcodes) and returns: unknown, ranks