class_docstr: Pipeline wrapper with 'export_pipeline'/'import_pipeline' methods
  allowing user to upload a pipeline to JSON format and import it from JSON.
  
  :params pipeline: Pipeline object to export or empty Pipeline to import
class_docstr_tok: ["Pipeline","wrapper","with","'export_pipeline'\/'import_pipeline","'","methods","allowing","user","to","upload","a","pipeline","to","JSON","format","and","import","it","from","JSON",".",":","params","pipeline",":","Pipeline","object","to","export","or","empty","Pipeline","to","import"]
docstr: Save JSON to path and return this JSON like object
  
  Args:
      path: custom path to save JSON to
      root_node: root node of the exported pipeline
      create_subdir: if True -- create one more dir in the last dir.
                     Useful for saving pipelines with fitted_operations & preprocessing.
                     if False -- save to the last dir in this path.
                     Useful for pipelines without fitted_operations or
                     when you want to know the exact name of the folder.
      is_datetime_in_path: is it required to add the datetime timestamp to the path.
  
  :return: <JSON representation of the pipeline structure>, <dict of paths to fitted models>
docstr_tok: ["Save","JSON","to","path","and","return","this","JSON","like","object","Args",":","path",":","custom","path","to","save","JSON","to","root_node",":","root","node","of","the","exported","pipeline","create_subdir",":","if","True","--","create","one","more","dir","in","the","last","dir",".","Useful","for","saving","pipelines","with","fitted_operations","&","preprocessing",".","if","False","--","save","to","the","last","dir","in","this","path",".","Useful","for","pipelines","without","fitted_operations","or","when","you","want","to","know","the","exact","name","of","the","folder",".","is_datetime_in_path",":","is","it","required","to","add","the","datetime","timestamp","to","the","path",".",":","return",":","<","JSON","representation","of","the","pipeline","structure",">",",","<","dict","of","paths","to","fitted","models",">"]
code: def export_pipeline(
      self,
      path: Optional[str] = None,
      root_node: Optional[PipelineNode] = None,
      create_subdir: bool = True,
      is_datetime_in_path: bool = False,
  ) -> Tuple[str, dict]:
      """
      Save JSON to path and return this JSON like object
  
      Args:
          path: custom path to save JSON to
          root_node: root node of the exported pipeline
          create_subdir: if True -- create one more dir in the last dir.
                         Useful for saving pipelines with fitted_operations & preprocessing.
                         if False -- save to the last dir in this path.
                         Useful for pipelines without fitted_operations or
                         when you want to know the exact name of the folder.
          is_datetime_in_path: is it required to add the datetime timestamp to the path.
  
      :return: <JSON representation of the pipeline structure>, <dict of paths to fitted models>
      """
  
      pipeline_template_dict = self.convert_to_dict(root_node)
      fitted_ops = {}
      if path is None:
          fitted_ops = self._create_fitted_operations()
          if fitted_ops is not None:
              for operation in pipeline_template_dict["nodes"]:
                  saved_key = f'operation_{operation["operation_id"]}'
                  if saved_key not in fitted_ops:
                      saved_key = None
                  pipeline_template_dict[
                      "fitted_operation_path"
                  ] = saved_key
  
      json_data = json.dumps(
          pipeline_template_dict, indent=4, cls=NumpyIntEncoder
      )
  
      if path is None:
          return json_data, fitted_ops
  
      path_to_dir, path_to_pipe = self._prepare_paths(
          path,
          create_subdir=create_subdir,
          is_datetime_in_path=is_datetime_in_path,
      )
      with open(path_to_pipe, "w", encoding="utf-8") as f:
          f.write(json_data)
          self.log.debug(
              f"The pipeline saved in the path: {path_to_pipe}."
          )
  
      dict_fitted_operations = self._create_fitted_operations(
          path_to_dir
      )
  
      return json_data, dict_fitted_operations
  
imports: import json
  import os
  from collections import Counter
  from datetime import datetime
  from io import BytesIO
  from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Union
  from uuid import uuid4
  import joblib
  import numpy
  from golem.core.log import default_log
  from fedot.core.operations.atomized_template import AtomizedModelTemplate
  from fedot.core.operations.operation_template import OperationTemplate, check_existing_path
  from fedot.core.pipelines.node import PipelineNode
  from fedot.core.repository.operation_types_repository import atomized_model_type
  from fedot.preprocessing.dummy_preprocessing import DummyPreprocessor
  from fedot.preprocessing.preprocessing import DataPreprocessor
label_desc: Use image node_id 4 for calling the PipelineTemplate obj's underlying member method code with example usage: obj.export_pipeline(path, root_node, create_subdir, is_datetime_in_path) and returns: json_data,  dict_fitted_operations, json_data,  fitted_ops