def METHOD_NAME(cls, config: PretrainedConfig) -> Type['ModelForDownstreamTasks']:
    """
    Dynamically creates and returns a model class from a PreTrainedConfig.
    """
    ptm_base_class = MODEL_FOR_PRETRAINING_MAPPING[config.__class__]
    model_name = config.__class__.__name__.rstrip('Config')
    class_name = f'{model_name}{cls.__name__}'
    model_class = type(class_name, (cls, ptm_base_class), {})
    # noinspection PyTypeChecker
    return model_class