code: def _extend_parser(parser):
      parser.add_argument(
          "--persistent-test-artifacts-dir",
          type=str,
          default=None,
          help=(
              "If specified, test artifacts such as Core ML models and generated images are saved in this directory. ",
              "Otherwise, all artifacts are erased after the test program terminates.",
          ),
      )
      parser.add_argument(
          "--fast",
          action="store_true",
          help="If specified, runs fewer repeats for `test_end_to_end_image_generation_speed`",
      )
      parser.add_argument(
          "--test-image-to-prompt-clip-score-opt-in",
          action="store_true",
          help=(
              "If specified, enables `test_image_to_prompt_clip_score` to verify the relevance of the "
              "generated image content to the original text prompt. This test is an opt-in "
              "test because it involves an additional one time 600MB model download."
          ),
      )
      parser.add_argument(
          "--test-swift-cli-opt-in",
          action="store_true",
          help=(
              "If specified, compiles all models and builds the Swift CLI to run image generation and compares "
              "results across Python and Swift runtime"
          ),
      )
      parser.add_argument(
          "--test-safety-checker-efficacy-opt-in",
          action="store_true",
          help=(
              "If specified, generates a potentially NSFW image to check whether the `safety_checker` "
              "accurately detects and removes the content"
          ),
      )
      return parser
  
imports: import argparse
  import contextlib
  import coremltools
  from diffusers import StableDiffusionPipeline
  import json
  import logging
  import numpy
  import os
  import unittest
  from PIL import Image
  from statistics import median
  import tempfile
  import time
  import torch
  from python_coreml_stable_diffusion import torch2coreml, pipeline, coreml_model
label_desc: Use image node_id 3 for calling a global function with example usage: _extend_parser(parser) and returns: parser