code: def _prepare_output_paths(artifact: types.Artifact):
      """Create output directories for output artifact."""
      if fileio.exists(artifact.uri):
          absl.logging.warning(
              "Output artifact uri %s already exists", artifact.uri
          )
          # TODO(b/158689199): We currently simply return as a short-term workaround
          # to unblock execution retires. A comprehensive solution to guarantee
          # idempotent executions is needed.
          return
  
      # TODO(b/147242148): Introduce principled artifact structure (directory
      # or file) definition.
      if isinstance(artifact, types.ValueArtifact):
          artifact_dir = os.path.dirname(artifact.uri)
      else:
          artifact_dir = artifact.uri
  
      # TODO(zhitaoli): Consider refactoring this out into something
      # which can handle permission bits.
      absl.logging.debug(
          "Creating output artifact uri %s as directory", artifact_dir
      )
      fileio.makedirs(artifact_dir)
  
file_path: tfx/tfx/dsl/components/base/base_driver.py
imports: import os
  from typing import Any, Dict, List
  import absl
  from tfx import types
  from tfx.dsl.io import fileio
  from tfx.orchestration import data_types
  from tfx.orchestration import metadata
  from tfx.types import artifact_utils
  from tfx.types import channel_utils
label_desc: Use image node_id 2 for calling a global function with example usage: _prepare_output_paths(artifact) without return types