pub fn dump_to_csv_or_print<T: Serialize + Debug>(
    output: &Option<PathBuf>,
    result: impl Iterator<Item = T> + Debug
) -> Result<(), Error>