def index_type(self, idx):

    if not isinstance(idx, Type):
      idx = idx.type

    if idx.__class__ is TupleT:
      indices = idx.elt_types
    else:
      indices = (idx,)

    n_indices = len(indices)
    n_required = self.rank
    if n_required > n_indices:
      n_missing = n_required - n_indices
      extra_indices = (NoneType,) * n_missing
      indices = indices + extra_indices

    # we lose one result dimension for each int in the index set
    result_rank = n_required
    for t in indices:
      if isinstance(t, (BoolT, IntT)):
        result_rank -= 1
      else:
        assert isinstance(t,  (TupleT, NoneT, SliceT, ArrayT, )),  "Unexpected index type: %s " % t
    if result_rank > 0:
      return make_array_type(self.elt_type, result_rank)
    else:
      return self.elt_type
:returns:
dataset/ETHPy150Open iskandr/parakeet/parakeet/ndtypes/array_type.py/ArrayT.index_type--crossover with--dataset/ETHPy150Open tabo/django-treebeard/treebeard/models.py/Node.get_descendants