docs: def index_to_coords(index, shape):
      '''convert index to coordinates given the shape'''
      coords = []
      for i in xrange(1, len(shape)):
          divisor = int(np.product(shape[i:]))
          value = index // divisor
          coords.append(value)
          index -= value * divisor
      coords.append(index)
      return tuple(coords)