code: def _export_csv(self, filepath, data, preview_data):
          
  
          # Get csv info
  
          csv_info = \
              self.main_window.interfaces.get_csv_export_info(preview_data)
  
          if csv_info is None:
              return
  
          try:
              dialect, digest_types, has_header = csv_info
          except TypeError:
              return
  
          # Export CSV file
  
          csv_interface = CsvInterface(self.main_window, filepath, dialect,
                                       digest_types, has_header)
  
          try:
              csv_interface.write(data)
  
          except IOError, err:
              msg = _("The file {filepath} could not be fully written\n \n"
                      "Error message:\n{msg}")
              msg = msg.format(filepath=filepath, msg=err)
              short_msg = _('Error writing CSV file')
              self.main_window.interfaces.display_warning(msg, short_msg)
docs: CSV export of code_array results
  
          Parameters
          ----------
          filepath: String
          \tPath of export file
          data: Object
          \tCode array result object slice, i. e. one object or iterable of
          \tsuch objects