docstr: Export fitted operation: either by path or directly as bytes-like object.
  Returns None for not fitted operation.
  
  :param return_path: path to directory for exporting the operation.
  If None, then bytes-like object is returned directly.
docstr_tok: ["Export","fitted","operation",":","either","by","path","or","directly","as","bytes-like","object",".","Returns","None","for","not","fitted","operation",".",":","param","return_path",":","path","to","directory","for","exporting","the","operation",".","If","None",",","then","bytes-like","object","is","returned","directly","."]
code: def export_operation(
      self, return_path: str = None
  ) -> Optional[Union[str, bytes, Any]]:
      """Export fitted operation: either by path or directly as bytes-like object.
      Returns None for not fitted operation.
  
      :param return_path: path to directory for exporting the operation.
      If None, then bytes-like object is returned directly.
      """
      if not self.fitted_operation:
          return None
  
      if return_path:
          check_existing_path(return_path)
  
          # dictionary with paths to saved fitted operations
          if "h2o" in self.operation_type:
              self.fitted_operation_path = (
                  self.fitted_operation.save_operation(
                      os.path.join(return_path, "fitted_operations"),
                      self.operation_id,
                  )
              )
              return self.fitted_operation_path
          else:
              path_fitted_operations = os.path.join(
                  return_path, "fitted_operations"
              )
              check_existing_path(path_fitted_operations)
              joblib.dump(
                  self.fitted_operation,
                  os.path.join(return_path, self.fitted_operation_path),
              )
              return os.path.join(
                  path_fitted_operations,
                  f"operation_{self.operation_id}.pkl",
              )
      else:
          # dictionary with bytes of fitted operations
          bytes_container = BytesIO()
          joblib.dump(self.fitted_operation, bytes_container)
          return bytes_container
  
imports: import os
  from abc import ABC, abstractmethod
  from io import BytesIO
  from typing import Any, Optional, Union
  import joblib
  import numpy
  from golem.core.log import default_log
  from fedot.core.pipelines.node import PipelineNode
label_desc: Use image node_id 6 for calling the OperationTemplate obj's underlying member method code with example usage: obj.export_operation(return_path) and returns: None, bytes_container, self, os