code: def to_pickle(self, filepath):
          
          if not isinstance(filepath, str):
              raise ValueError("filepath must be a string.")
  
          if not filepath.endswith(".pkl"):
              filepath = filepath + ".pkl"
  
          with open(filepath, "wb") as f:
              pickle.dump(self, f)
  
          print("Model saved to {}".format(filepath))
  
          return None
docs: Parameters
          ----------
          filepath : str.
              Should end in .pkl. If it does not, ".pkl" will be appended to the
              passed string.
  
          Returns
          -------
          None. Saves the model object to the location specified by `filepath`.