code: def preprocess_insertion_prompt(prompt: str) -> str:
      pattern = """</code>
  BEGIN SOLUTION
  <code>
  [insert]
  </code>
  END SOLUTION"""
      pattern_index = prompt.index(pattern)
      # pattern_block = prompt[pattern_index:]
      prefix = prompt[:pattern_index]
      # hit = False
      if pattern + "\n<code>" in prompt:
          index = prompt.index("<code>", pattern_index + len(pattern))
          suffix = prompt[index + len("<code>") :]
      else:
          # hit = True
          assert pattern in prompt
          suffix = ""
      final_prompt = prefix.strip() + "\n[insert]\n" + suffix.strip()
      final_prompt = final_prompt.replace(
          "<code>", "```python"
      ).replace("</code>", "```")
      # if hit:
      #     print(final_prompt)
      #     breakpoint()
      return final_prompt
  
file_path: magicoder/experiments/ds_1000.py
imports: import os
  from dataclasses import dataclass, field
  from pathlib import Path
  from typing import Callable, Literal, cast
  from ds1000 import DS1000Dataset, DS1000Problem
  from tqdm.auto import tqdm
  from transformers import HfArgumentParser
  from magicoder.llm_wrapper import GenerationConfig, ModelContext, create_infilling_prompt, get_model_context
  from magicoder.prompt_template import MAGICODER_PROMPT
label_desc: Use image node_id 5 for calling a global function with example usage: preprocess_insertion_prompt(prompt) and returns: final_prompt