code: def _validate_indexers(
          self, indexers: Mapping,
      ) -> List[Tuple[Any, Union[slice, Variable]]]:
          
          from .dataarray import DataArray
  
          invalid = [k for k in indexers if k not in self.dims]
          if invalid:
              raise ValueError("dimensions %r do not exist" % invalid)
  
          # all indexers should be int, slice, np.ndarrays, or Variable
          indexers_list = []  # type: List[Tuple[Any, Union[slice, Variable]]]
          for k, v in indexers.items():
              if isinstance(v, slice):
                  indexers_list.append((k, v))
                  continue
  
              if isinstance(v, Variable):
                  pass
              elif isinstance(v, DataArray):
                  v = v.variable
              elif isinstance(v, tuple):
                  v = as_variable(v)
              elif isinstance(v, Dataset):
                  raise TypeError('cannot use a Dataset as an indexer')
              elif isinstance(v, Sequence) and len(v) == 0:
                  v = IndexVariable((k, ), np.zeros((0,), dtype='int64'))
              else:
                  v = np.asarray(v)
  
                  if v.dtype.kind == 'U' or v.dtype.kind == 'S':
                      index = self.indexes[k]
                      if isinstance(index, pd.DatetimeIndex):
                          v = v.astype('datetime64[ns]')
                      elif isinstance(index, xr.CFTimeIndex):
                          v = _parse_array_of_cftime_strings(v, index.date_type)
  
                  if v.ndim == 0:
                      v = Variable((), v)
                  elif v.ndim == 1:
                      v = IndexVariable((k,), v)
                  else:
                      raise IndexError(
                          "Unlabeled multi-dimensional array cannot be "
                          "used for indexing: {}".format(k))
  
              if v.ndim == 1:
                  v = v.to_index_variable()
  
              indexers_list.append((k, v))
  
          return indexers_list
docs: Here we make sure
          + indexer has a valid keys
          + indexer is in a valid data type
          + string indexers are cast to the appropriate date type if the
            associated index is a DatetimeIndex or CFTimeIndex