code: def iterator(plugins, context):
      
      test = pyblish.logic.registered_test()
      state = {
          "nextOrder": None,
          "ordersWithError": set()
      }
  
      for plugin in plugins:
          state["nextOrder"] = plugin.order
  
          message = test(**state)
          if message:
              raise StopIteration("Stopped due to %s" % message)
  
          instances = pyblish.api.instances_by_plugin(context, plugin)
          if plugin.__instanceEnabled__:
              for instance in instances:
                  yield plugin, instance
  
          else:
              yield plugin, None
docs: An iterator for plug-in and instance pairs