code: def save_or_append_to_csv(df: pd.DataFrame, path: Path) -> None:
      """Saves a dataframe to a file in append mode"""
      if path.exists():
          print("Appending to existing file")
          try:
              predf = pd.read_csv(
                  str(path), on_bad_lines="warn"
              )  # , error_bad_lines=False)#, error_bad_lines=False)
          except:  # for some versions of Panda.
              predf = pd.read_csv(
                  str(path)
              )  # , error_bad_lines=False)#, error_bad_lines=False)
          df = pd.concat([predf, df], sort=False)
      df.to_csv(path, index=False)
  
imports: import datetime
  import warnings
  import itertools
  import importlib.util
  from pathlib import Path
  import numpy
  import pandas
  import nevergrad.common.typing
  from nevergrad.optimization.utils import SequentialExecutor
  from .experiments import registry
  from .experiments import Experiment
  from .None import utils
label_desc: Use image node_id 2 for calling a global function with example usage: save_or_append_to_csv(df, path) without return types