code: def printFlakeOutput(text):
      """Print flake output, colored by error category.
      Return 2 if there were any mandatory errors,
      1 if only recommended / optional errors, and
      0 if only optional errors.
      """
      ret = 0
      gotError = False
      for line in text.split("\n"):
          m = re.match(r"[^\:]+\:\d+\:\d+\: (\w+) .*", line)
          if m is None:
              print(line)
          else:
              gotError = True
              error = m.group(1)
              if error in FLAKE_MANDATORY:
                  print("\033[0;31m" + line + "\033[0m")
                  ret |= 2
              elif error in FLAKE_RECOMMENDED:
                  print("\033[0;33m" + line + "\033[0m")
                  # ret |= 1
              elif error in FLAKE_OPTIONAL:
                  print("\033[0;32m" + line + "\033[0m")
              elif error in FLAKE_IGNORE:
                  continue
              else:
                  print("\033[0;36m" + line + "\033[0m")
      if not gotError:
          print("    [ no errors ]\n")
      return ret
  
imports: from contextlib import suppress
  import json
  import os
  import re
  import shutil
  import subprocess
  import sys
  from distutils import core
  from typing import Dict, Any
  from .generateChangelog import generateDebianChangelog
label_desc: Use image node_id 2 for calling a global function with example usage: printFlakeOutput(text) and returns: ret