code: def from_dict(cls, d):
          
  
          if not set(['coords', 'data_vars']).issubset(set(d)):
              variables = d.items()
          else:
              import itertools
              variables = itertools.chain(d.get('coords', {}).items(),
                                          d.get('data_vars', {}).items())
          try:
              variable_dict = OrderedDict([(k, (v['dims'],
                                                v['data'],
                                                v.get('attrs'))) for
                                           k, v in variables])
          except KeyError as e:
              raise ValueError(
                  "cannot convert dict without the key "
                  "'{dims_data}'".format(dims_data=str(e.args[0])))
          obj = cls(variable_dict)
  
          # what if coords aren't dims?
          coords = set(d.get('coords', {})) - set(d.get('dims', {}))
          obj = obj.set_coords(coords)
  
          obj.attrs.update(d.get('attrs', {}))
  
          return obj
docs: Convert a dictionary into an xarray.Dataset.
  
          Input dict can take several forms::
  
              d = {'t': {'dims': ('t'), 'data': t},
                   'a': {'dims': ('t'), 'data': x},
                   'b': {'dims': ('t'), 'data': y}}
  
              d = {'coords': {'t': {'dims': 't', 'data': t,
                                    'attrs': {'units':'s'}}},
                   'attrs': {'title': 'air temperature'},
                   'dims': 't',
                   'data_vars': {'a': {'dims': 't', 'data': x, },
                                 'b': {'dims': 't', 'data': y}}}
  
          where 't' is the name of the dimesion, 'a' and 'b' are names of data
          variables and t, x, and y are lists, numpy.arrays or pandas objects.
  
          Parameters
          ----------
          d : dict, with a minimum structure of {'var_0': {'dims': [..], \
                                                           'data': [..]}, \
                                                 ...}
  
          Returns
          -------
          obj : xarray.Dataset
  
          See also
          --------
          Dataset.to_dict
          DataArray.from_dict