def __setitem__(self, kper, data):
    if (kper in list(self.__data.keys())):
        if self._model.verbose:
            print('removing existing data for kper={}'.format(kper))
        self.data.pop(kper)
    if isinstance(data, list):
        try:
            data = np.array(data)
        except Exception as e:
            raise Exception(('MfList error: casting list to ndarray: ' + str(e)))
    if isinstance(data, int):
        self.__cast_int(kper, data)
    elif isinstance(data, np.recarray):
        self.__cast_recarray(kper, data)
    elif isinstance(data, np.ndarray):
        self.__cast_ndarray(kper, data)
    elif isinstance(data, str):
        self.__cast_str(kper, data)
    else:
        raise Exception(('MfList error: unsupported data type: ' + str(type(data))))
def __setitem__(self, kper, data):
    if (kper in list(self.__data.keys())):
        if self._model.verbose:
            print('removing existing data for kper={}'.format(kper))
        self.data.pop(kper)
    if isinstance(data, list):
        try:
            data = np.array(data)
        except Exception as e:
            raise Exception(('MfList error: casting list to ndarray: ' + str(e)))
    if isinstance(data, int):
        self.__cast_int(kper, data)
    elif isinstance(data, np.recarray):
        self.__cast_recarray(kper, data)
    elif isinstance(data, np.ndarray):
        self.__cast_ndarray(kper, data)
    elif isinstance(data, str):
        self.__cast_str(kper, data)
    else:
        raise Exception(('MfList error: unsupported data type: ' + str(type(data))))