code: def increment(index, dims, data_shape):
      
  
      # check dimensions of data match structure
      inc_to_match = data_shape[1:]
      for dim_a, dim_b in zip(inc_to_match, dims[-1*(len(inc_to_match)):]):
          if dim_a != dim_b:
              raise DataIndexError()
  
      # now we can safely discard all but the highest dimension
      inc_index = len(index) - len(data_shape)
      inc_amount = data_shape[0]
      # make the index and increment amount dimensions match
      index[inc_index] += inc_amount
  
      # finally check that we did not run over allowed dimension
      if index[inc_index] > dims[inc_index]:
          raise DataIndexError()
  
      while inc_index > 0 and index[inc_index] == dims[inc_index]:
          index[inc_index-1] +=1
          index[inc_index:] = [0]*len(index[inc_index:])
          inc_index -=1
      return index
docs: Increments a given index according to the shape of the data added
  
      :param index: Current index to be incremented
      :type index: list
      :param dims: Shape of the data that the index is being incremented by
      :type dims: tuple
      :param data_shape: Shape of the data structure being incremented, this is check that incrementing is correct
      :returns: list - the incremented index