code: def global_to_local(self, index):
          
          if (type(index) is int) or (type(index) is slice):
              if len(self.__mask) > 1:
                  raise IndexError('check length of parameter index')
              # 1D array
              if type(index) is int:
                  return self.int_global_to_local(index)
  
              elif type(index) is slice:
                  return self.slice_global_to_local(index)
  
              else:
                  raise IndexError('check data type of index to be integer or slice')
  
          elif type(index) is tuple:
              #if len(index) is not len(self.__mask):
              #    raise IndexError('check length of parameter index')
  
              local_index = []
  
              for k, item in enumerate(index):
                  if k < len(self.__mask):
  
                      if type(item) is slice:
                          temp_index = self.slice_global_to_local(item, k)
  
                      elif type(item) in [int, np.int64, np.int32]:
                          temp_index = self.int_global_to_local(item, k)
  
                      if temp_index is None:
                          return temp_index
  
                  else:
                      temp_index = item
  
                  local_index.append(temp_index)
  
              return tuple(local_index)
          else:
              raise IndexError('check index for correct length and type')
docs: Calculate local index from global index
  
          :param index: input index
          :return: local index for data