code: def prepare_reports(title, header, reports, to_truncate=True):
      report = ""
  
      MAX_ERROR_TEXT = 3000 - len("[Truncated]")
      if not to_truncate:
          MAX_ERROR_TEXT = float("inf")
  
      if len(reports) > 0:
          # `text` must be less than 3001 characters in Slack SDK
          # keep some room for adding "[Truncated]" when necessary
  
          for idx in range(len(reports)):
              _report = header + "\n".join(reports[: idx + 1])
              new_report = f"{title}:\n```\n{_report}\n```\n"
              if len(new_report) > MAX_ERROR_TEXT:
                  # `report` here has length <= 3000
                  report = report + "[Truncated]"
                  break
              report = new_report
  
      return report
  
imports: import ast
  import collections
  import functools
  import json
  import math
  import operator
  import os
  import re
  import sys
  import time
  from typing import Dict, List, Optional, Union
  import requests
  from slack_sdk import WebClient
label_desc: Use image node_id 7 for calling a global function with example usage: prepare_reports(title, header, reports, to_truncate) and returns: report