@exporter('<STR_LIT>', ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'))<EOL>def save_csv(filename, dat, index=False, **kw):
import pandas<EOL>from neuropythy.util import to_dataframe<EOL>d = to_dataframe(dat)<EOL>if any(filename.endswith(s) for s in ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>')):<EOL><INDENT>with gzip.open(filename, '<STR_LIT>', newlines='<STR_LIT>') as fl: d.to_csv(fl, index=index, **kw)<EOL><DEDENT>else:<EOL><INDENT>with open(filename, '<STR_LIT>') as fl: d.to_csv(fl, index=index, **kw)<EOL><DEDENT>return dat<EOL>
save_csv(filename, d) writes a pandas dataframe d to a CSV file with the given name. If pandas
  cannot be loaded, then an error is raised. If d is not a dataframe, to_dataframe() is called
  on it.

All optional arguments are passed along to the pandas.DataFrame.to_csv function.