class_docstr: Helper methods for Vertex Handler.
class_docstr_tok: ["Helper","methods","for","Vertex","Handler","."]
docstr: Create a directory for pipeline definition in the handler directory.
docstr_tok: ["Create","a","directory","for","pipeline","definition","in","the","handler","directory","."]
code: def _prepare_pipeline_dir(
      self, pipeline_name: str, required: bool
  ) -> str:
      """Create a directory for pipeline definition in the handler directory."""
  
      self._check_pipeline_existence(pipeline_name, required)
  
      handler_pipeline_path = self._get_pipeline_dir(pipeline_name)
  
      # If updating pipeline, first delete the pipeline directory.
      if fileio.exists(handler_pipeline_path):
          io_utils.delete_dir(handler_pipeline_path)
  
      fileio.makedirs(handler_pipeline_path)
  
      # pipeline.json will be stored in KubeflowV2DagRunner.run().
      return handler_pipeline_path
  
imports: import functools
  import os
  import sys
  import click
  from google.cloud import aiplatform
  from google.cloud.aiplatform import pipeline_jobs
  from tfx.dsl.io import fileio
  from tfx.tools.cli import labels
  from tfx.tools.cli.handler import base_handler
  from tfx.tools.cli.handler import kubeflow_handler
  from tfx.tools.cli.handler import kubeflow_v2_dag_runner_patcher
  from tfx.utils import io_utils
label_desc: Use image node_id 14 for calling the VertexHandler obj's underlying member method code with example usage: obj._prepare_pipeline_dir(pipeline_name, required) and returns: handler_pipeline_path