code: def clean_code_for_chat(result):
      lines = result.split("\n")
      idx = 0
      while idx < len(lines) and not lines[idx].lstrip().startswith(
          "```"
      ):
          idx += 1
      explanation = "\n".join(lines[:idx]).strip()
      if idx == len(lines):
          return explanation, None
  
      idx += 1
      start_idx = idx
      while not lines[idx].lstrip().startswith("```"):
          idx += 1
      code = "\n".join(lines[start_idx:idx]).strip()
  
      return explanation, code
  
imports: import importlib.util
  import json
  import os
  import time
  from dataclasses import dataclass
  from typing import Dict
  import requests
  from huggingface_hub import HfFolder, hf_hub_download, list_spaces
  from ..models.auto import AutoTokenizer
  from ..utils import is_offline_mode, is_openai_available, is_torch_available, logging
  from .base import TASK_MAPPING, TOOL_CONFIG_FILE, Tool, load_tool, supports_remote
  from .prompts import CHAT_MESSAGE_PROMPT, download_prompt
  from .python_interpreter import evaluate
label_desc: Use image node_id 5 for calling a global function with example usage: clean_code_for_chat(result) and returns: explanation,  code, explanation,  None