# Buggy code
def auto_suggest_network(dataset, net):
    if isinstance(dataset, str):
        dataset_name = dataset
    elif isinstance(dataset, AutoGluonObject):
        if "name" in dataset.kwargs:
            dataset_name = dataset.kwargs["name"]
        else:
            return net
    else:
        return net
    dataset_name = dataset_name.lower()
    if "mnist" in dataset_name:
        if isinstance(net, str) or isinstance(net, Categorical):
            net = mnist_net()
            logger.info(
                "Auto suggesting network net for dataset {}".format(net, dataset_name)
            )
            return net
    elif "cifar" in dataset_name:
        if isinstance(net, str):
            if "cifar" not in net:
                net = "cifar_resnet20_v1"
        elif isinstance(net, Categorical):
            newdata = []
            for x in net.data:
                if "cifar" in x:
                    newdata.append(x)
            net.data = (
                newdata
                if len(newdata) > 0
                else ["cifar_resnet20_v1", "cifar_resnet56_v1"]
            )
        logger.info(
            "Auto suggesting network net for dataset {}".format(net, dataset_name)
        )
        return net


# Traceback (TypeError)
scheduler: FIFOScheduler(
DistributedResourceManager{
(Remote: Remote REMOTE_ID: 0,
<Remote: 'inproc://172.18.30.18/28461/1' processes=1 threads=4, memory=7.28 GB>, Resource: NodeResourceManager(4 CPUs, 0 GPUs))
})

Starting Experiments
Num of Finished Tasks is 0
Num of Pending Tasks is 4
25%|█████████████████████▌                                                                | 1/4 [00:00<00:00,  8.97it/s]Process Process-2:
Traceback (most recent call last):
File "/home/z/anaconda3/envs/IC2/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/home/z/anaconda3/envs/IC2/lib/python3.6/multiprocessing/process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "/home/z/anaconda3/envs/IC2/lib/python3.6/site-packages/autogluon/scheduler/scheduler.py", line 125, in _worker
ret = fn(**kwargs)
File "/home/z/anaconda3/envs/IC2/lib/python3.6/site-packages/autogluon/core/decorator.py", line 52, in __call__
args = sample_config(args, new_config)
File "/home/z/anaconda3/envs/IC2/lib/python3.6/site-packages/autogluon/core/decorator.py", line 38, in sample_config
args_dict[k] = v.init()
File "/home/z/anaconda3/envs/IC2/lib/python3.6/site-packages/autogluon/core/space.py", line 110, in init
return self.sample(**config)
File "/home/z/anaconda3/envs/IC2/lib/python3.6/site-packages/autogluon/core/decorator.py", line 185, in sample
return self.func(*self.args, **kwargs)
File "/home/z/anaconda3/envs/IC2/lib/python3.6/site-packages/autogluon/task/image_classification/dataset.py", line 108, in get_dataset
if '.rec' in path:
TypeError: argument of type 'NoneType' is not iterable

# Fixed code
def auto_suggest_network(dataset, net):
    if isinstance(dataset, str):
        dataset_name = dataset
    elif isinstance(dataset, AutoGluonObject):
        if "name" in dataset.kwargs and dataset.kwargs["name"] is not None:
            dataset_name = dataset.kwargs["name"]
        else:
            return net
    else:
        return net
    dataset_name = dataset_name.lower()
    if "mnist" in dataset_name:
        if isinstance(net, str) or isinstance(net, Categorical):
            net = mnist_net()
            logger.info(
                "Auto suggesting network net for dataset {}".format(net, dataset_name)
            )
            return net
    elif "cifar" in dataset_name:
        if isinstance(net, str):
            if "cifar" not in net:
                net = "cifar_resnet20_v1"
        elif isinstance(net, Categorical):
            newdata = []
            for x in net.data:
                if "cifar" in x:
                    newdata.append(x)
            net.data = (
                newdata
                if len(newdata) > 0
                else ["cifar_resnet20_v1", "cifar_resnet56_v1"]
            )
        logger.info(
            "Auto suggesting network net for dataset {}".format(net, dataset_name)
        )
        return net