<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def global_to_local(self, index):
 """ Calculate local index from global index :param index: input index :return: local index for data """

        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')