code: def model_from_string(self, model_str, verbose=True):
          
          if self.handle is not None:
              _safe_call(_LIB.LGBM_BoosterFree(self.handle))
          self._free_buffer()
          self.handle = ctypes.c_void_p()
          out_num_iterations = ctypes.c_int(0)
          _safe_call(_LIB.LGBM_BoosterLoadModelFromString(
              c_str(model_str),
              ctypes.byref(out_num_iterations),
              ctypes.byref(self.handle)))
          out_num_class = ctypes.c_int(0)
          _safe_call(_LIB.LGBM_BoosterGetNumClasses(
              self.handle,
              ctypes.byref(out_num_class)))
          if verbose:
              print('Finished loading model, total used %d iterations' % int(out_num_iterations.value))
          self.__num_class = out_num_class.value
          self.pandas_categorical = _load_pandas_categorical(model_str=model_str)
          return self
docs: Load Booster from a string.
  
          Parameters
          ----------
          model_str : string
              Model will be loaded from this string.
          verbose : bool, optional (default=True)
              Whether to print messages while loading model.
  
          Returns
          -------
          self : Booster
              Loaded Booster object.