def METHOD_NAME(self, module: Any, name: Optional[str] = None) -> None:
    if name is None:
        name = str(len(self._modules))
        if name in self._modules:
            raise KeyError('name exists')
    self.add_module(name, module)