code: def save(forecaster, path: str):
      """Save a fitted Neural Prophet model to disk.
  
      Parameters:
          forecaster : np.forecaster.NeuralProphet
              input forecaster that is fitted
          path : str
              path and filename to be saved. filename could be any but suggested to have extension .np.
  
      After you fitted a model, you may save the model to save_test_model.np
          >>> from neuralprophet import save
          >>> save(forecaster, "test_save_model.np")
      """
      # List of attributes to remove
      attrs_to_remove_forecaster = ["trainer"]
      attrs_to_remove_model = ["_trainer"]
  
      # Store removed attributes temporarily
      removed_attrs = {}
  
      # Remove specified attributes from forecaster
      for attr in attrs_to_remove_forecaster:
          if hasattr(forecaster, attr):
              removed_attrs[attr] = getattr(forecaster, attr)
              setattr(forecaster, attr, None)
  
      # Remove specified attributes from forecaster.model
      for attr in attrs_to_remove_model:
          if hasattr(forecaster.model, attr):
              removed_attrs[attr] = getattr(forecaster.model, attr)
              setattr(forecaster.model, attr, None)
  
      # Perform the save operation
      try:
          torch.save(forecaster, path)
      except Exception as e:
          print(f"An error occurred while saving the model: {e}")
          raise
      finally:
          # Restore the removed attributes
          for attr, value in removed_attrs.items():
              if hasattr(forecaster, attr):
                  setattr(forecaster, attr, value)
              elif hasattr(forecaster.model, attr):
                  setattr(forecaster.model, attr, value)
  
imports: from __future__ import annotations
  import logging
  import math
  import os
  import sys
  from collections import OrderedDict
  from typing import TYPE_CHECKING, Iterable, Optional, Union
  import numpy
  import pandas
  import pytorch_lightning
  import torch
  from neuralprophet import utils_torch
  from neuralprophet.hdays_utils import get_country_holidays
  from neuralprophet.logger import ProgressBar
label_desc: Use image node_id 1 for calling a global function with example usage: save(forecaster, path) without return types