code: def unregister_factory(self, factory_name):
          # type: (str) -> bool
          
          if not factory_name or not is_string(factory_name):
              # Invalid name
              return False
  
          with self.__factories_lock:
              try:
                  # Remove the factory from the registry
                  factory_class = self.__factories.pop(factory_name)
              except KeyError:
                  # Unknown factory
                  return False
  
              # Trigger an event
              self._fire_ipopo_event(
                  constants.IPopoEvent.UNREGISTERED, factory_name
              )
  
              # Invalidate and delete all components of this factory
              with self.__instances_lock:
                  # Compute the list of __instances to remove
                  to_remove = self.__get_stored_instances(factory_name)
  
                  # Remove instances from the registry: avoids dependencies \
                  # update to link against a component from this factory again.
                  for instance in to_remove:
                      try:
                          # Kill the instance
                          self.kill(instance.name)
                      except ValueError:
                          # Unknown instance: already killed by the invalidation
                          # callback of a component killed in this loop
                          # => ignore
                          pass
  
                  # Remove waiting component
                  names = [
                      name
                      for name, (context, _) in self.__waiting_handlers.items()
                      if context.factory_context.name == factory_name
                  ]
                  for name in names:
                      del self.__waiting_handlers[name]
  
              # Clear the bundle context of the factory
              _set_factory_context(factory_class, None)
  
          return True
docs: Unregisters the given component factory
  
          :param factory_name: Name of the factory to unregister
          :return: True the factory has been removed, False if the factory is
                   unknown