docs: def instantiate(self, factory_name, name, properties=None):
          # type: (str, str, dict) -> Any
          """
          Instantiates a component from the given factory, with the given name
  
          :param factory_name: Name of the component factory
          :param name: Name of the instance to be started
          :param properties: Initial properties of the component instance
          :return: The component instance
          :raise TypeError: The given factory is unknown
          :raise ValueError: The given name or factory name is invalid, or an
                             instance with the given name already exists
          :raise Exception: Something wrong occurred in the factory
          """
          # Test parameters
          if not factory_name or not is_string(factory_name):
              raise ValueError("Invalid factory name")
  
          if not name or not is_string(name):
              raise ValueError("Invalid component name")
  
          if not self.running:
              # Stop working if the framework is stopping
              raise ValueError("Framework is stopping")
  
          with self.__instances_lock:
              if name in self.__instances or name in self.__waiting_handlers:
                  raise ValueError(
                      "'{0}' is an already running instance name".format(name)
                  )
  
              with self.__factories_lock:
                  # Can raise a TypeError exception
                  factory, factory_context = self.__get_factory_with_context(
                      factory_name
                  )
  
                  # Check if the factory is singleton and if a component is
                  # already started
                  if (
                      factory_context.is_singleton
                      and factory_context.is_singleton_active
                  ):
                      raise ValueError(
                          "{0} is a singleton: {1} can't be "
                          "instantiated.".format(factory_name, name)
                      )
  
                  # Create component instance
                  try:
                      instance = factory()
                  except Exception:
                      _logger.exception(
                          "Error creating the instance '%s' from factory '%s'",
                          name,
                          factory_name,
                      )
                      raise TypeError(
                          "Factory '{0}' failed to create '{1}'".format(
                              factory_name, name
                          )
                      )
  
                  # Instantiation succeeded: update singleton status
                  if factory_context.is_singleton:
                      factory_context.is_singleton_active = True
  
              # Normalize the given properties
              properties = self._prepare_instance_properties(
                  properties, factory_context.properties
              )
  
              # Set up the component instance context
              component_context = ComponentContext(
                  factory_context, name, properties
              )
  
              # Try to instantiate the component immediately
              if not self.__try_instantiate(component_context, instance):
                  # A handler is missing, put the component in the queue
                  self.__waiting_handlers[name] = (component_context, instance)
  
          return instance