class_docstr: Base Handler for CLI.
  
  Attributes:
    flags_dict: A dictionary with flags provided in a command.
docstr: Check if pipeline folder exists and if not, exit system.
  
  Args:
    pipeline_name: Name of the pipeline.
    required: Set it as True if pipeline needs to exist else set it to False.
code: def _check_pipeline_existence(
      self, pipeline_name: str, required: bool = True
  ) -> None:
      """Check if pipeline folder exists and if not, exit system.
  
      Args:
        pipeline_name: Name of the pipeline.
        required: Set it as True if pipeline needs to exist else set it to False.
      """
      handler_pipeline_path = os.path.join(
          self._handler_home_dir, pipeline_name
      )
      # Check if pipeline folder exists.
      exists = fileio.exists(handler_pipeline_path)
      if required and not exists:
          # Check pipeline directory prior 0.25 and move files to the new location
          # automatically.
          old_handler_pipeline_path = os.path.join(
              self._get_deprecated_handler_home(), pipeline_name
          )
          if fileio.exists(old_handler_pipeline_path):
              fileio.makedirs(os.path.dirname(handler_pipeline_path))
              fileio.rename(
                  old_handler_pipeline_path, handler_pipeline_path
              )
              engine_flag = self.flags_dict[labels.ENGINE_FLAG]
              handler_home_variable = engine_flag.upper() + "_HOME"
              click.echo(
                  (
                      '[WARNING] Pipeline "{pipeline_name}" was found in "{old_path}", '
                      "but the location that TFX stores pipeline information was moved "
                      "since TFX 0.25.0.\n"
                      '[WARNING] Your files in "{old_path}" was automatically moved to '
                      'the new location, "{new_path}".\n'
                      "[WARNING] If you want to keep the files at the old location, set "
                      '`{handler_home}` environment variable to "{old_handler_home}".'
                  ).format(
                      pipeline_name=pipeline_name,
                      old_path=old_handler_pipeline_path,
                      new_path=handler_pipeline_path,
                      handler_home=handler_home_variable,
                      old_handler_home=self._get_deprecated_handler_home(),
                  ),
                  err=True,
              )
          else:
              sys.exit(
                  'Pipeline "{}" does not exist.'.format(pipeline_name)
              )
      elif not required and exists:
          sys.exit(
              'Pipeline "{}" already exists.'.format(pipeline_name)
          )
  
imports: import abc
  from importlib import machinery
  from importlib import util
  import json
  import os
  import subprocess
  import sys
  from typing import Any, Collection, Dict, List, Optional
  import click
  from tfx.dsl.components.base import base_driver
  from tfx.dsl.io import fileio
  from tfx.tools.cli import labels
  from tfx.tools.cli.handler import dag_runner_patcher
  from tfx.utils import io_utils
label_desc: Use image node_id 18 for calling the BaseHandler obj's underlying member method code with example usage: obj._check_pipeline_existence(pipeline_name, required) without return types