code: def iter_factories():
      
      # retrieve all of the factories with
      factories = (entry.load() for entry in iter_entry_points(FACTORY_ENTRYPOINT))
  
      # sort the factories from highest priority to lowest. Any factory with unknown priority
      # gets assigned priority -1000.
      for factory in sorted(factories, key=lambda f: getattr(f, 'priority', -1000), reverse=True):
          yield factory
docs: Iterate through all factories identified by the factory entrypoint.
  
      Yields:
          function: A function that accepts a :class:`.Specification` and
          returns a :class:`.PenaltyModel`.