code: def export_process_to_csv(bpmn_diagram, directory, filename):
          
          nodes = copy.deepcopy(bpmn_diagram.get_nodes())
          start_nodes = []
          export_elements = []
  
          for node in nodes:
              incoming_list = node[1].get(consts.Consts.incoming_flow)
              if len(incoming_list) == 0:
                  start_nodes.append(node)
          if len(start_nodes) != 1:
              raise bpmn_exception.BpmnPythonError("Exporting to CSV format accepts only one start event")
  
          nodes_classification = utils.BpmnImportUtils.generate_nodes_clasification(bpmn_diagram)
          start_node = start_nodes.pop()
          BpmnDiagramGraphCsvExport.export_node(bpmn_diagram, export_elements, start_node, nodes_classification)
  
          try:
              os.makedirs(directory)
          except OSError as exception:
              if exception.errno != errno.EEXIST:
                  raise
          file_object = open(directory + filename, "w")
          file_object.write("Order,Activity,Condition,Who,Subprocess,Terminated\n")
          BpmnDiagramGraphCsvExport.write_export_node_to_file(file_object, export_elements)
          file_object.close()
docs: Root method of CSV export functionality.
  
          :param bpmn_diagram: an instance of BpmnDiagramGraph class,
          :param directory: a string object, which is a path of output directory,
          :param filename: a string object, which is a name of output file.