code: def reformat_block(
      string,
      indent=0,
      indent_first=True,
      prefix="",
      prefix_first=True,
      strip="\n",
  ):
      if not string:
          return prefix if prefix_first else ""
      lines = string.strip(strip).split("\n")
      if len(lines) == 1:
          return (
              (prefix if prefix_first else "")
              + (indent * " " if indent_first else "")
              + lines[0].strip()
          )
      line0_indent = len(lines[0]) - len(lines[0].lstrip())
      out = ""
      for idx, line in enumerate(lines):
          dedented_line = line.lstrip()
          line_indent = len(line) - len(dedented_line)
          rel_indent = line_indent - line0_indent
          pref = prefix if (prefix_first or idx > 0) else ""
          if dedented_line:
              ind = (
                  (indent + rel_indent) * " "
                  if (indent_first or idx > 0)
                  else ""
              )
              out += pref + ind + dedented_line + "\n"
          else:
              out += pref + "\n"
      return out.strip(strip)
  
imports: from collections import defaultdict
  import linecache
  import os
label_desc: Use image node_id 2 for calling a global function with example usage: reformat_block(string, indent, indent_first, prefix, prefix_first, strip) and returns: out, unknown, unknown