code: def build_code_rgb(
      rgb: Tuple[int, int, int],
      rgb_bg: Union[None, Tuple[int, int, int]] = None,
  ):
      """
      Utility function to generate the appropriate ANSI RGB codes for a given set of foreground (font) and background colors.
      """
      output = _ANSI_CODES["begin"]
      output += _ANSI_CODES["foreground_rgb"]
      output += ";".join([str(i) for i in rgb])
      output += "m"
      if rgb_bg:
          output += _ANSI_CODES["begin"]
          output += _ANSI_CODES["background_rgb"]
          output += ";".join([str(i) for i in rgb_bg])
          output += "m"
      return output
  
file_path: pennylane/pennylane/logging/formatters/formatter.py
imports: import logging
  from logging import Formatter
  from typing import NamedTuple, Tuple, Union
label_desc: Use image node_id 1 for calling a global function with example usage: build_code_rgb(rgb, rgb_bg) and returns: output