code: def _load_bundle_factories(bundle):
      # type: (Bundle) -> List[Tuple[FactoryContext, type]]
      
      result = []
  
      # Get the Python module
      module_ = bundle.get_module()
  
      # Get the bundle context
      bundle_context = bundle.get_bundle_context()
  
      for name in dir(module_):
          try:
              # Get the module member
              factory_class = getattr(module_, name)
              if not inspect.isclass(factory_class):
                  continue
  
              # Check if it is a class
              if sys.modules[factory_class.__module__] is not module_:
                  # Only keep classes from this module
                  continue
          except (AttributeError, KeyError):
              # getattr() didn't work or __module__ is not a member of the class,
              # or the module is not known by the interpreter
              continue
  
          context = _set_factory_context(factory_class, bundle_context)
          if context is None:
              # Error setting up the factory context
              continue
  
          result.append((context, factory_class))
  
      return result
docs: Retrieves a list of pairs (FactoryContext, factory class) with all
      readable manipulated classes found in the bundle.
  
      :param bundle: A Bundle object
      :return: The list of factories loaded from the bundle