def _validate_dataset_names(dataset):
    def check_name(name):
        if isinstance(name, basestring):
            if not name:
                raise ValueError('Invalid name for DataArray or Dataset key: '
                                 'string must be length 1 or greater for '
                                 'serialization to netCDF files')
        elif name is not None:
            raise TypeError('DataArray.name or Dataset key must be either a '
                            'string or None for serialization to netCDF files')

    for k in dataset:
        check_name(k)
DataArray.name and Dataset keys must be a string or None
dataset/ETHPy150Open pydata/xarray/xarray/backends/api.py/_validate_dataset_names