code: def replace_nan_with_None(df):
      new_df = pd.DataFrame()
  
      def replace_val(val):
          if isinstance(val, (tuple, list)):
              return list([None if pd.isna(x) else x for x in val])
          elif pd.isna(val):
              return None
          else:
              return val
  
      for c in df.columns:
          new_df[c] = df[c].apply(replace_val)
          new_df[c] = new_df[c].astype(df[c].dtype)
  
      return new_df
  
imports: import pandas
label_desc: Use image node_id 2 for calling a global function with example usage: replace_nan_with_None(df) and returns: new_df, list, None, val