code: def _unregister_bundle_factories(self, bundle):
          # type: (Bundle) -> None
          
          with self.__factories_lock:
              # Find out which factories must be removed
              to_remove = [
                  factory_name
                  for factory_name in self.__factories
                  if self.get_factory_bundle(factory_name) is bundle
              ]
  
              # Remove all of them
              for factory_name in to_remove:
                  try:
                      self.unregister_factory(factory_name)
                  except ValueError as ex:
                      _logger.warning(
                          "Error unregistering factory '%s': %s", factory_name, ex
                      )
docs: Unregisters all factories of the given bundle
  
          :param bundle: A bundle