docs: def chunk(self, chunks=None, name_prefix='xarray-', token=None,
                lock=False):
          """Coerce all arrays in this dataset into dask arrays with the given
          chunks.
  
          Non-dask arrays in this dataset will be converted to dask arrays. Dask
          arrays will be rechunked to the given chunk sizes.
  
          If neither chunks is not provided for one or more dimensions, chunk
          sizes along that dimension will not be updated; non-dask arrays will be
          converted into dask arrays with a single block.
  
          Parameters
          ----------
          chunks : int or dict, optional
              Chunk sizes along each dimension, e.g., ``5`` or
              ``{'x': 5, 'y': 5}``.
          name_prefix : str, optional
              Prefix for the name of any new dask arrays.
          token : str, optional
              Token uniquely identifying this dataset.
          lock : optional
              Passed on to :py:func:`dask.array.from_array`, if the array is not
              already as dask array.
  
          Returns
          -------
          chunked : xarray.Dataset
          """
          try:
              from dask.base import tokenize
          except ImportError:
              # raise the usual error if dask is entirely missing
              import dask  # noqa
              raise ImportError('xarray requires dask version 0.9 or newer')
  
          if isinstance(chunks, Number):
              chunks = dict.fromkeys(self.dims, chunks)
  
          if chunks is not None:
              bad_dims = [d for d in chunks if d not in self.dims]
              if bad_dims:
                  raise ValueError('some chunks keys are not dimensions on this '
                                   'object: %s' % bad_dims)
  
          def selkeys(dict_, keys):
              if dict_ is None:
                  return None
              return dict((d, dict_[d]) for d in keys if d in dict_)
  
          def maybe_chunk(name, var, chunks):
              chunks = selkeys(chunks, var.dims)
              if not chunks:
                  chunks = None
              if var.ndim > 0:
                  token2 = tokenize(name, token if token else var._data)
                  name2 = '%s%s-%s' % (name_prefix, name, token2)
                  return var.chunk(chunks, name=name2, lock=lock)
              else:
                  return var
  
          variables = OrderedDict([(k, maybe_chunk(k, v, chunks))
                                   for k, v in self.variables.items()])
          return self._replace(variables)