code: def Register(self, name, constructor):
      
      precondition.AssertType(name, Text)
  
      if name in self._constructors:
        message = "Duplicated constructors %r and %r for name '%s'"
        message %= (constructor, self._constructors[name], name)
        raise ValueError(message)
  
      self._constructors[name] = constructor
docs: Registers a new constructor in the factory.
  
      Args:
        name: A name associated with given constructor.
        constructor: A constructor function that creates instances.
  
      Raises:
        ValueError: If there already is a constructor associated with given name.