code: def transpose(self, *dims):
          if dims:
              if set(dims) ^ set(self.dims):
                  raise ValueError('arguments to transpose (%s) must be '
                                   'permuted dataset dimensions (%s)'
                                   % (dims, tuple(self.dims)))
          ds = self.copy()
          for name, var in self._variables.items():
              var_dims = tuple(dim for dim in dims if dim in var.dims)
              ds._variables[name] = var.transpose(*var_dims)
          return ds