def METHOD_NAME(config: Union[ConfigDict, Type[object], None]) -> Type[BaseConfig]:
    if config is None:
        return BaseConfig
    else:
        config_dict = (
            config
            if isinstance(config, dict)
            else {k: getattr(config, k) for k in dir(config) if not k.startswith('__')}
        )
        class Config(BaseConfig):
            ...
        for k, v in config_dict.items():
            setattr(Config, k, v)
        return Config