<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_dataset(config: dict, output_dir: Optional[str]=None) -> AbstractDataset: """ Create a dataset object according to the given config. Dataset config section and the `output_dir` are passed to the constructor in a single YAML-encoded string. :param config: config dict with dataset config :param output_dir: path to the training output dir or None :return: dataset object """

    logging.info('Creating dataset')

    dataset_config = make_simple(config)['dataset']
    assert 'class' in dataset_config, '`dataset.class` not present in the config'
    dataset_module, dataset_class = parse_fully_qualified_name(dataset_config['class'])

    if 'output_dir' in dataset_config:
        raise ValueError('The `output_dir` key is reserved and can not be used in dataset configuration.')

    dataset_config = {'output_dir': output_dir, **config['dataset']}
    del dataset_config['class']

    dataset = create_object(dataset_module, dataset_class, args=(yaml_to_str(dataset_config),))
    logging.info('\t%s created', type(dataset).__name__)
    return dataset